namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0003 : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.HrmPsCommand",
                c => new
                    {
                        CmdId = c.Int(nullable: false, identity: true),
                        CmdFlag = c.String(nullable: false),
                        CmdDraftNo = c.String(),
                        CmdName = c.String(nullable: false),
                        CmdDescr = c.String(unicode: false, storeType: "text"),
                        CmdRefNo = c.String(nullable: false),
                        CmdTypeId = c.Int(nullable: false),
                        EmpTypeId = c.Int(nullable: false),
                        JobSiteId = c.Int(),
                        PenaltyId = c.Int(),
                        CmdStatus = c.String(),
                        ApprovedId = c.Int(),
                        ApprovedName = c.String(),
                        ApprovedPositions = c.String(),
                        ApprovedDate = c.DateTime(),
                        CmdRptDate = c.String(),
                        Confirm = c.Int(),
                        RptHeader = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        HrmPsCommandTypes_CmdTypeId = c.Int(),
                        HrmPsEmployeeTypes_EmpTypeId = c.Int(),
                        HrmMpJobSites_JobSiteId = c.Int(),
                        approver_EmpId = c.Int(),
                        HrmDcPenalty_PenId = c.Int(),
                    })
                .PrimaryKey(t => t.CmdId)
                .ForeignKey("dbo.HrmPsCommandType", t => t.HrmPsCommandTypes_CmdTypeId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.HrmPsEmployeeTypes_EmpTypeId)
                .ForeignKey("dbo.hrm_job_site", t => t.HrmMpJobSites_JobSiteId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.approver_EmpId)
                .ForeignKey("dbo.HrmDcPenalty", t => t.HrmDcPenalty_PenId)
                .ForeignKey("dbo.HrmPsCommandType", t => t.CmdTypeId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .ForeignKey("dbo.HrmDcPenalty", t => t.PenaltyId)
                .ForeignKey("dbo.HrmPsCommand", t => t.ApprovedId)
                .Index(t => t.HrmPsCommandTypes_CmdTypeId)
                .Index(t => t.HrmPsEmployeeTypes_EmpTypeId)
                .Index(t => t.HrmMpJobSites_JobSiteId)
                .Index(t => t.approver_EmpId)
                .Index(t => t.HrmDcPenalty_PenId)
                .Index(t => t.CmdTypeId)
                .Index(t => t.EmpTypeId)
                .Index(t => t.JobSiteId)
                .Index(t => t.PenaltyId)
                .Index(t => t.ApprovedId);
            
            CreateTable(
                "dbo.HrmPsCommandType",
                c => new
                    {
                        CmdTypeId = c.Int(nullable: false, identity: true),
                        CmdTypeCode = c.String(),
                        CmdTypeName = c.String(),
                        CmdTypeNameShort = c.String(),
                        CmdGroupId = c.Int(),
                        RptFormat = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        RptHeader = c.String(),
                        HrmPsCommandGroups_CmdGroupId = c.Int(),
                    })
                .PrimaryKey(t => t.CmdTypeId)
                .ForeignKey("dbo.HrmPsCommandGroup", t => t.HrmPsCommandGroups_CmdGroupId)
                .ForeignKey("dbo.HrmPsCommandGroup", t => t.CmdGroupId)
                .Index(t => t.HrmPsCommandGroups_CmdGroupId)
                .Index(t => t.CmdGroupId);
            
            CreateTable(
                "dbo.HrmPsCommandGroup",
                c => new
                    {
                        CmdGroupId = c.Int(nullable: false, identity: true),
                        CmdGroupName = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.CmdGroupId);
            
            CreateTable(
                "dbo.HrmDcPenalty",
                c => new
                    {
                        PenId = c.Int(nullable: false, identity: true),
                        PenName = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PenId);
            
            CreateTable(
                "dbo.HrmPsCommandDtls",
                c => new
                    {
                        CmdDtlsId = c.Int(nullable: false, identity: true),
                        CmdId = c.Int(nullable: false),
                        EmpId = c.Int(nullable: false),
                        StartDate = c.DateTime(nullable: false),
                        EndDate = c.DateTime(),
                        EduHisId = c.Int(),
                        Remarks = c.String(),
                        RptRemarks = c.String(),
                        MoveId = c.Int(),
                        OldPosId = c.Int(),
                        OldPosRef = c.String(),
                        OldPosName = c.String(),
                        OldExecPosName = c.String(),
                        OldClassId = c.Int(),
                        OldJobSiteId = c.Int(),
                        OldJobSiteName = c.String(),
                        OldWorkingJobSiteId = c.Int(),
                        OldWorkingJobSiteName = c.String(),
                        OldSalary = c.Double(),
                        OldExecSalary = c.Double(),
                        OldPosLine = c.String(),
                        OldPosTypeId = c.Int(),
                        OldExecPosId = c.Int(),
                        NewPosId = c.Int(),
                        NewPosRef = c.String(),
                        NewPosName = c.String(),
                        NewExecPosName = c.String(),
                        NewClassId = c.Int(),
                        NewJobSiteId = c.Int(),
                        NewJobSiteName = c.String(),
                        NewWorkingJobSiteId = c.Int(),
                        NewWorkingJobSiteName = c.String(),
                        NewSalary = c.Double(),
                        NewExecSalary = c.Double(),
                        NewPosLine = c.String(),
                        NewPosTypeId = c.Int(),
                        NewExecPosId = c.Int(),
                        OldDepName = c.String(),
                        OldWorkingDepName = c.String(),
                        NewDepName = c.String(),
                        NewWorkingDepName = c.String(),
                        PrmBase = c.Double(),
                        PrmPercent = c.Decimal(precision: 18, scale: 2),
                        PrmAmount = c.Double(),
                        Remarks2 = c.String(),
                        EntNo = c.Int(),
                        EntPosName = c.String(),
                        EntPosTypeId = c.Int(),
                        EntClassId = c.Int(),
                        EntJobSiteName = c.String(),
                        EntDate = c.DateTime(),
                        BackDate = c.DateTime(),
                        TmpEmpId = c.Int(),
                        TmpEduId = c.Int(),
                        CurrPosClassDate = c.DateTime(),
                        QuitDate = c.DateTime(),
                        CurrencyId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        old_HrmMpPositions_PosId = c.Int(),
                        old_HrmMpClasses_ClassId = c.Int(),
                        old_HrmMpJobSites_JobSiteId = c.Int(),
                        old_working_HrmMpJobSites_JobSiteId = c.Int(),
                        old_HrmMpExecPositions_ExecPosId = c.Int(),
                        new_HrmMpPositions_PosId = c.Int(),
                        new_HrmMpClasses_ClassId = c.Int(),
                        new_HrmMpJobSites_JobSiteId = c.Int(),
                        new_working_HrmMpJobSites_JobSiteId = c.Int(),
                        new_HrmMpExecPositions_ExecPosId = c.Int(),
                    })
                .PrimaryKey(t => t.CmdDtlsId)
                .ForeignKey("dbo.HrmPsCommand", t => t.CmdId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_position", t => t.old_HrmMpPositions_PosId)
                .ForeignKey("dbo.HrmMpClass", t => t.old_HrmMpClasses_ClassId)
                .ForeignKey("dbo.hrm_job_site", t => t.old_HrmMpJobSites_JobSiteId)
                .ForeignKey("dbo.hrm_job_site", t => t.old_working_HrmMpJobSites_JobSiteId)
                .ForeignKey("dbo.hrm_executive_position", t => t.old_HrmMpExecPositions_ExecPosId)
                .ForeignKey("dbo.hrm_position", t => t.new_HrmMpPositions_PosId)
                .ForeignKey("dbo.HrmMpClass", t => t.new_HrmMpClasses_ClassId)
                .ForeignKey("dbo.hrm_job_site", t => t.new_HrmMpJobSites_JobSiteId)
                .ForeignKey("dbo.hrm_job_site", t => t.new_working_HrmMpJobSites_JobSiteId)
                .ForeignKey("dbo.hrm_executive_position", t => t.new_HrmMpExecPositions_ExecPosId)
                .ForeignKey("dbo.HrmPsEduHistory", t => t.EduHisId)
                .ForeignKey("dbo.HrmEsMoveRequest", t => t.MoveId)
                .ForeignKey("dbo.hrm_position", t => t.OldPosId)
                .ForeignKey("dbo.hrm_mas_class", t => t.OldClassId)
                .ForeignKey("dbo.hrm_job_site", t => t.OldJobSiteId)
                .ForeignKey("dbo.hrm_job_site", t => t.OldWorkingJobSiteId)
                .ForeignKey("dbo.HrmMasPositionType", t => t.OldPosTypeId)
                .ForeignKey("dbo.hrm_executive_position", t => t.OldExecPosId)
                .ForeignKey("dbo.hrm_position", t => t.NewPosId)
                .ForeignKey("dbo.hrm_mas_class", t => t.NewClassId)
                .ForeignKey("dbo.hrm_job_site", t => t.NewJobSiteId)
                .ForeignKey("dbo.hrm_job_site", t => t.NewWorkingJobSiteId)
                .ForeignKey("dbo.HrmMasPositionType", t => t.NewPosTypeId)
                .ForeignKey("dbo.hrm_executive_position", t => t.NewExecPosId)
                .ForeignKey("dbo.HrmMasPositionType", t => t.EntPosTypeId)
                .ForeignKey("dbo.hrm_mas_class", t => t.EntClassId)
                .ForeignKey("dbo.HrmTmpEmployee", t => t.TmpEmpId)
                .ForeignKey("dbo.HrmTmpEmployeeEducation", t => t.TmpEduId)
                .ForeignKey("dbo.MasCurrency", t => t.CurrencyId)
                .Index(t => t.CmdId)
                .Index(t => t.EmpId)
                .Index(t => t.old_HrmMpPositions_PosId)
                .Index(t => t.old_HrmMpClasses_ClassId)
                .Index(t => t.old_HrmMpJobSites_JobSiteId)
                .Index(t => t.old_working_HrmMpJobSites_JobSiteId)
                .Index(t => t.old_HrmMpExecPositions_ExecPosId)
                .Index(t => t.new_HrmMpPositions_PosId)
                .Index(t => t.new_HrmMpClasses_ClassId)
                .Index(t => t.new_HrmMpJobSites_JobSiteId)
                .Index(t => t.new_working_HrmMpJobSites_JobSiteId)
                .Index(t => t.new_HrmMpExecPositions_ExecPosId)
                .Index(t => t.EduHisId)
                .Index(t => t.MoveId)
                .Index(t => t.OldPosId)
                .Index(t => t.OldClassId)
                .Index(t => t.OldJobSiteId)
                .Index(t => t.OldWorkingJobSiteId)
                .Index(t => t.OldPosTypeId)
                .Index(t => t.OldExecPosId)
                .Index(t => t.NewPosId)
                .Index(t => t.NewClassId)
                .Index(t => t.NewJobSiteId)
                .Index(t => t.NewWorkingJobSiteId)
                .Index(t => t.NewPosTypeId)
                .Index(t => t.NewExecPosId)
                .Index(t => t.EntPosTypeId)
                .Index(t => t.EntClassId)
                .Index(t => t.TmpEmpId)
                .Index(t => t.TmpEduId)
                .Index(t => t.CurrencyId);
            
            CreateTable(
                "dbo.HrmMpClass",
                c => new
                    {
                        ClassId = c.Int(nullable: false, identity: true),
                        ClassNo = c.String(),
                        ClassName = c.String(),
                        ClassNameShort = c.String(),
                        ClassEng = c.String(),
                        ClassEngShort = c.String(),
                        PosTypeId = c.Int(),
                        EmpTypeId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        Remarks = c.String(),
                    })
                .PrimaryKey(t => t.ClassId)
                .ForeignKey("dbo.HrmMpPositionType", t => t.PosTypeId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .Index(t => t.PosTypeId)
                .Index(t => t.EmpTypeId);
            
            CreateTable(
                "dbo.HrmMpPositionType",
                c => new
                    {
                        PosTypeId = c.Int(nullable: false, identity: true),
                        PosTypeName = c.String(),
                        PosTypeNameShort = c.String(),
                        PosTypeEng = c.String(),
                        PosTypeEngShort = c.String(),
                        EmpTypeId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        HrmPsEmployeeTypes_EmpTypeId = c.Int(),
                    })
                .PrimaryKey(t => t.PosTypeId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.HrmPsEmployeeTypes_EmpTypeId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .Index(t => t.HrmPsEmployeeTypes_EmpTypeId)
                .Index(t => t.EmpTypeId);
            
            CreateTable(
                "dbo.HrmPsEduHistory",
                c => new
                    {
                        EduHisId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(),
                        EduDegreeId = c.Int(),
                        EduQualId = c.Int(),
                        EduMajorId = c.Int(),
                        EduInsId = c.Int(),
                        EduStartYear = c.Int(),
                        EduEndYear = c.Int(),
                        StartDate = c.DateTime(),
                        EndDate = c.DateTime(),
                        Gpa = c.Decimal(precision: 18, scale: 2),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        HrmPsEmployees_EmpId = c.Int(),
                    })
                .PrimaryKey(t => t.EduHisId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.HrmPsEmployees_EmpId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.MasEduDegree", t => t.EduDegreeId)
                .ForeignKey("dbo.MasEduQualification", t => t.EduQualId)
                .ForeignKey("dbo.MasEduMajor", t => t.EduMajorId)
                .ForeignKey("dbo.MasEduInstitute", t => t.EduInsId)
                .Index(t => t.HrmPsEmployees_EmpId)
                .Index(t => t.EmpId)
                .Index(t => t.EduDegreeId)
                .Index(t => t.EduQualId)
                .Index(t => t.EduMajorId)
                .Index(t => t.EduInsId);
            
            CreateTable(
                "dbo.MasEduDegree",
                c => new
                    {
                        EduDegreeId = c.Int(nullable: false, identity: true),
                        EduDegreeCode = c.String(),
                        EduDegreeName = c.String(),
                        EduDegreeNameEng = c.String(),
                        EduDegreeQualification = c.String(),
                        ComparativeLevel = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EduDegreeId);
            
            CreateTable(
                "dbo.MasEduQualification",
                c => new
                    {
                        EduQualId = c.Int(nullable: false, identity: true),
                        EduQualCode = c.String(),
                        EduQualName = c.String(),
                        EduQualNameEng = c.String(),
                        EduQualNameShort = c.String(),
                        EduDegreeId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EduQualId)
                .ForeignKey("dbo.MasEduDegree", t => t.EduDegreeId)
                .Index(t => t.EduDegreeId);
            
            CreateTable(
                "dbo.HrmTmpEmployeeEducation",
                c => new
                    {
                        TmpEduId = c.Int(nullable: false, identity: true),
                        TmpEmpId = c.Int(),
                        EduQualId = c.Int(),
                        EduMajorId = c.Int(),
                        EduInsId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        MasEduInstitute_EduInsId = c.Int(),
                        MasEduInstitutes_EduInsId = c.Int(),
                        MasEduMajor_EduMajorId = c.Int(),
                        MasEduMajors_EduMajorId = c.Int(),
                        MasEduQualifications_EduQualId = c.Int(),
                        TmpEmployee_TmpEmpId = c.Int(),
                        HrmTmpEmployees_TmpEmpId = c.Int(),
                        MasEduQualification_EduQualId = c.Int(),
                    })
                .PrimaryKey(t => t.TmpEduId)
                .ForeignKey("dbo.MasEduInstitute", t => t.MasEduInstitute_EduInsId)
                .ForeignKey("dbo.MasEduInstitute", t => t.MasEduInstitutes_EduInsId)
                .ForeignKey("dbo.MasEduMajor", t => t.MasEduMajor_EduMajorId)
                .ForeignKey("dbo.MasEduMajor", t => t.MasEduMajors_EduMajorId)
                .ForeignKey("dbo.MasEduQualification", t => t.MasEduQualifications_EduQualId)
                .ForeignKey("dbo.HrmTmpEmployee", t => t.TmpEmployee_TmpEmpId)
                .ForeignKey("dbo.HrmTmpEmployee", t => t.HrmTmpEmployees_TmpEmpId)
                .ForeignKey("dbo.HrmTmpEmployee", t => t.TmpEmpId)
                .ForeignKey("dbo.MasEduQualification", t => t.EduQualId)
                .ForeignKey("dbo.MasEduMajor", t => t.EduMajorId)
                .ForeignKey("dbo.MasEduInstitute", t => t.EduInsId)
                .ForeignKey("dbo.MasEduQualification", t => t.MasEduQualification_EduQualId)
                .Index(t => t.MasEduInstitute_EduInsId)
                .Index(t => t.MasEduInstitutes_EduInsId)
                .Index(t => t.MasEduMajor_EduMajorId)
                .Index(t => t.MasEduMajors_EduMajorId)
                .Index(t => t.MasEduQualifications_EduQualId)
                .Index(t => t.TmpEmployee_TmpEmpId)
                .Index(t => t.HrmTmpEmployees_TmpEmpId)
                .Index(t => t.TmpEmpId)
                .Index(t => t.EduQualId)
                .Index(t => t.EduMajorId)
                .Index(t => t.EduInsId)
                .Index(t => t.MasEduQualification_EduQualId);
            
            CreateTable(
                "dbo.MasEduInstitute",
                c => new
                    {
                        EduInsId = c.Int(nullable: false, identity: true),
                        EduInsCode = c.String(),
                        EduInsName = c.String(),
                        EduInsEng = c.String(),
                        EduGov = c.Int(),
                        Address = c.String(),
                        DistrictId = c.Int(),
                        PostalCode = c.String(),
                        Tel = c.String(),
                        Fax = c.String(),
                        CountryId = c.Int(),
                        MaxEduDegreeId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EduInsId)
                .ForeignKey("dbo.HrmMasDistrict", t => t.DistrictId)
                .ForeignKey("dbo.HrmMasCountry", t => t.CountryId)
                .ForeignKey("dbo.MasEduDegree", t => t.MaxEduDegreeId)
                .Index(t => t.DistrictId)
                .Index(t => t.CountryId)
                .Index(t => t.MaxEduDegreeId);
            
            CreateTable(
                "dbo.MasEduMajor",
                c => new
                    {
                        EduMajorId = c.Int(nullable: false, identity: true),
                        EduMajorCode = c.String(),
                        EduMajorName = c.String(),
                        EduMajorNameEng = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EduMajorId);
            
            CreateTable(
                "dbo.HrmTmpEmployee",
                c => new
                    {
                        TmpEmpId = c.Int(nullable: false, identity: true),
                        NamePrefixId = c.Int(),
                        FirstName = c.String(),
                        LastName = c.String(),
                        FirstNameEng = c.String(),
                        LastNameEng = c.String(),
                        NickName = c.String(),
                        GenderId = c.Int(),
                        ReligionId = c.Int(),
                        RaceNatId = c.Int(),
                        NatId = c.Int(),
                        BirthDate = c.DateTime(),
                        EmpStatusId = c.Int(),
                        Citizen = c.String(),
                        TaxPayer = c.String(),
                        Social = c.String(),
                        Official = c.String(),
                        BloodGroupId = c.Int(),
                        MarrStatId = c.Int(),
                        EntTypeId = c.Int(),
                        EmpTypeId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TmpEmpId)
                .ForeignKey("dbo.hrm_mas_nationality", t => t.NamePrefixId)
                .ForeignKey("dbo.hrm_mas_gender", t => t.GenderId)
                .ForeignKey("dbo.hrm_mas_religion", t => t.ReligionId)
                .ForeignKey("dbo.hrm_mas_nationality", t => t.RaceNatId)
                .ForeignKey("dbo.hrm_mas_nationality", t => t.NatId)
                .ForeignKey("dbo.hrm_mas_employee_status", t => t.EmpStatusId)
                .ForeignKey("dbo.MasBloodGroup", t => t.BloodGroupId)
                .ForeignKey("dbo.hrm_mas_marital_status", t => t.MarrStatId)
                .ForeignKey("dbo.HrmRcEntryType", t => t.EntTypeId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .Index(t => t.NamePrefixId)
                .Index(t => t.GenderId)
                .Index(t => t.ReligionId)
                .Index(t => t.RaceNatId)
                .Index(t => t.NatId)
                .Index(t => t.EmpStatusId)
                .Index(t => t.BloodGroupId)
                .Index(t => t.MarrStatId)
                .Index(t => t.EntTypeId)
                .Index(t => t.EmpTypeId);
            
            CreateTable(
                "dbo.MasBloodGroup",
                c => new
                    {
                        BloodGroupId = c.Int(nullable: false, identity: true),
                        BloodGroupName = c.String(),
                        BloodGroupNameEng = c.String(),
                        RecordStatus = c.String(),
                        Remarks = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.BloodGroupId);
            
            CreateTable(
                "dbo.HrmRcEntryType",
                c => new
                    {
                        EntTypeId = c.Int(nullable: false, identity: true),
                        EntTypeName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EntTypeId);
            
            CreateTable(
                "dbo.HrmEsMoveRequest",
                c => new
                    {
                        ReqId = c.Int(nullable: false, identity: true),
                        RefNo = c.String(),
                        EmpId = c.Int(),
                        ApprovedStatus = c.String(),
                        ApprovedDate = c.DateTime(),
                        ApprovedId = c.Int(),
                        ApprovedPosition = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ReqId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.HrmPsCommand", t => t.ApprovedId)
                .Index(t => t.EmpId)
                .Index(t => t.ApprovedId);
            
            CreateTable(
                "dbo.MasCurrency",
                c => new
                    {
                        CurrencyId = c.Int(nullable: false, identity: true),
                        CurrencyName = c.String(),
                        CurrencyNameEng = c.String(),
                        Local = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                    })
                .PrimaryKey(t => t.CurrencyId);
            
            CreateTable(
                "dbo.HrmPsEmpContact",
                c => new
                    {
                        ContactId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(nullable: false),
                        NamePrefixId = c.Int(),
                        ContactName = c.String(),
                        ContactLastName = c.String(),
                        FamId = c.Int(),
                        ContactCareer = c.String(),
                        ContactAddress = c.String(),
                        DistrictId = c.Int(),
                        ContactPostalCode = c.String(),
                        Tel = c.String(),
                        Mobile = c.String(),
                        Email = c.String(),
                        ContactStatus = c.String(),
                        Citizen = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        HrmPsEmployees_EmpId = c.Int(),
                    })
                .PrimaryKey(t => t.ContactId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.HrmPsEmployees_EmpId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.NamePrefixId)
                .ForeignKey("dbo.MasFamilyhood", t => t.FamId)
                .ForeignKey("dbo.HrmMasDistrict", t => t.DistrictId)
                .Index(t => t.HrmPsEmployees_EmpId)
                .Index(t => t.EmpId)
                .Index(t => t.NamePrefixId)
                .Index(t => t.FamId)
                .Index(t => t.DistrictId);
            
            CreateTable(
                "dbo.MasFamilyhood",
                c => new
                    {
                        FamId = c.Int(nullable: false, identity: true),
                        FamName = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FamId);
            
            CreateTable(
                "dbo.HrmMpScope",
                c => new
                    {
                        ScopeId = c.Int(nullable: false, identity: true),
                        ScopeName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ScopeId);
            
            CreateTable(
                "dbo.HrmMpDuty",
                c => new
                    {
                        DutyId = c.Int(nullable: false, identity: true),
                        DutyName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.DutyId);
            
            CreateTable(
                "dbo.HrmEsQuitRequest",
                c => new
                    {
                        ReqId = c.Int(nullable: false, identity: true),
                        RefNo = c.String(),
                        EmpId = c.Int(),
                        StartDate = c.DateTime(),
                        ApprovedStatus = c.String(),
                        ApprovedDate = c.DateTime(),
                        ApprovedId = c.Int(),
                        ApprovedPosition = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ReqId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.HrmPsCommand", t => t.ApprovedId)
                .Index(t => t.EmpId)
                .Index(t => t.ApprovedId);
            
            CreateTable(
                "dbo.HrmPsEmployeeStatus",
                c => new
                    {
                        EmpStatusId = c.Int(nullable: false, identity: true),
                        EmpStatusName = c.String(),
                        Active = c.String(),
                        EmpStatusCode = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EmpStatusId);
            
            CreateTable(
                "dbo.HrmPsEmployeeType",
                c => new
                    {
                        EmpTypeId = c.Int(nullable: false, identity: true),
                        EmpTypeName = c.String(),
                        SalaryUpTime = c.Int(),
                        Retirements = c.Int(),
                        Royalitems = c.Int(),
                        YearTypeId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EmpTypeId)
                .ForeignKey("dbo.sys_year_type", t => t.YearTypeId)
                .Index(t => t.YearTypeId);
            
            CreateTable(
                "dbo.HrmMpPosition",
                c => new
                    {
                        PosId = c.Int(nullable: false, identity: true),
                        PosRef = c.String(),
                        PosName = c.String(),
                        FieldPosId = c.Int(),
                        ExecPosId = c.Int(),
                        EmpTypeId = c.Int(),
                        DateDefined = c.DateTime(),
                        DateMoneySupport = c.DateTime(),
                        DateChanged = c.DateTime(),
                        ChangeRefNo = c.String(),
                        SalaryQuota = c.Double(),
                        LastSalaryQuota = c.Double(),
                        JobSiteId = c.Int(),
                        PosStatus = c.String(),
                        SalaryMin = c.Double(),
                        SalaryMax = c.Double(),
                        PosExecSalary = c.Double(),
                        PosUpperId = c.Int(),
                        PosWorkingUpperId = c.Int(),
                        JobDescription = c.String(),
                        SkillId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        SalaryGlow = c.Double(),
                        CurrencyId = c.Int(),
                    })
                .PrimaryKey(t => t.PosId)
                .ForeignKey("dbo.HrmFieldPosition", t => t.FieldPosId)
                .ForeignKey("dbo.hrm_executive_position", t => t.ExecPosId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .ForeignKey("dbo.hrm_position", t => t.PosUpperId)
                .ForeignKey("dbo.hrm_position", t => t.PosWorkingUpperId)
                .ForeignKey("dbo.HrmPsEmpSkill", t => t.SkillId)
                .ForeignKey("dbo.MasCurrency", t => t.CurrencyId)
                .Index(t => t.FieldPosId)
                .Index(t => t.ExecPosId)
                .Index(t => t.EmpTypeId)
                .Index(t => t.JobSiteId)
                .Index(t => t.PosUpperId)
                .Index(t => t.PosWorkingUpperId)
                .Index(t => t.SkillId)
                .Index(t => t.CurrencyId);
            
            CreateTable(
                "dbo.HrmPsEmpSkill",
                c => new
                    {
                        SkillId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(nullable: false),
                        SkillTypeId = c.Int(),
                        SkillDescr = c.String(),
                        Remarks = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.SkillId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.MasSkillType", t => t.SkillTypeId)
                .Index(t => t.EmpId)
                .Index(t => t.SkillTypeId);
            
            CreateTable(
                "dbo.MasSkillType",
                c => new
                    {
                        SkillTypeId = c.Int(nullable: false, identity: true),
                        SkillTypeName = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.SkillTypeId);
            
            CreateTable(
                "dbo.HrmMpExecPosition",
                c => new
                    {
                        ExecPosId = c.Int(nullable: false, identity: true),
                        ExecPosCode = c.String(),
                        ExecPosName = c.String(),
                        ExecPosNameShort = c.String(),
                        ExecPosNameEng = c.String(),
                        ExecPosNameEngShort = c.String(),
                        ExecPosGroupId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ExecPosId)
                .ForeignKey("dbo.SysExecPosGroup", t => t.ExecPosGroupId)
                .Index(t => t.ExecPosGroupId);
            
            CreateTable(
                "dbo.SysExecPosGroup",
                c => new
                    {
                        ExecPosGroupId = c.Int(nullable: false, identity: true),
                        ExecPosGroupName = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ExecPosGroupId);
            
            CreateTable(
                "dbo.HrmMpFieldPosition",
                c => new
                    {
                        FieldPosId = c.Int(nullable: false, identity: true),
                        FieldPosCode = c.String(),
                        FieldPosName = c.String(),
                        FieldPosNameEng = c.String(),
                        FieldPosLine = c.String(),
                        FieldPosLineShort = c.String(),
                        FieldPosLineEng = c.String(),
                        EmpTypeId = c.Int(),
                        PosTypeId = c.Int(),
                        FieldGroupId = c.Int(),
                        ClassSpecId = c.Int(),
                        FieldPosSeqNew = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FieldPosId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .ForeignKey("dbo.HrmMasPositionType", t => t.PosTypeId)
                .ForeignKey("dbo.HrmMpFieldGroup", t => t.FieldGroupId)
                .ForeignKey("dbo.HrmMasClassSpecification", t => t.ClassSpecId)
                .Index(t => t.EmpTypeId)
                .Index(t => t.PosTypeId)
                .Index(t => t.FieldGroupId)
                .Index(t => t.ClassSpecId);
            
            CreateTable(
                "dbo.HrmMpFieldGroup",
                c => new
                    {
                        FieldGroupId = c.Int(nullable: false, identity: true),
                        FieldGroupName = c.String(),
                        FieldGroupDescr = c.String(),
                        EmpTypeId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FieldGroupId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .Index(t => t.EmpTypeId);
            
            CreateTable(
                "dbo.HrmMasClassSpecification",
                c => new
                    {
                        ClassSpecId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        NameEng = c.String(),
                        PosTypeId = c.Int(),
                        ClassMax = c.Int(),
                        ClassMin = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ClassSpecId);
            
            CreateTable(
                "dbo.HrmMpFieldDuty",
                c => new
                    {
                        FieldDutyId = c.Int(nullable: false, identity: true),
                        FieldPosId = c.Int(),
                        ClassId = c.Int(),
                        Descr = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FieldDutyId)
                .ForeignKey("dbo.HrmFieldPosition", t => t.FieldPosId)
                .ForeignKey("dbo.hrm_mas_class", t => t.ClassId)
                .Index(t => t.FieldPosId)
                .Index(t => t.ClassId);
            
            CreateTable(
                "dbo.HrmMpFieldDutyDtls",
                c => new
                    {
                        FieldDutyDtlsId = c.Int(nullable: false, identity: true),
                        FieldDutyId = c.Int(nullable: false),
                        DutyId = c.Int(),
                        SeqNo = c.String(),
                        Descr = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FieldDutyDtlsId)
                .ForeignKey("dbo.HrmMpFieldDuty", t => t.FieldDutyId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMpDuty", t => t.DutyId)
                .Index(t => t.FieldDutyId)
                .Index(t => t.DutyId);
            
            CreateTable(
                "dbo.HrmMpFieldSpecificationDtls",
                c => new
                    {
                        FieldSpecDtlsId = c.Int(nullable: false, identity: true),
                        FieldSpecId = c.Int(),
                        PosTypeId = c.Int(),
                        ClassId = c.Int(),
                        Durations = c.Decimal(precision: 18, scale: 2),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FieldSpecDtlsId)
                .ForeignKey("dbo.HrmMpFieldSpecification", t => t.FieldSpecId)
                .ForeignKey("dbo.HrmMasPositionType", t => t.PosTypeId)
                .ForeignKey("dbo.hrm_mas_class", t => t.ClassId)
                .Index(t => t.FieldSpecId)
                .Index(t => t.PosTypeId)
                .Index(t => t.ClassId);
            
            CreateTable(
                "dbo.HrmMpFieldSpecification",
                c => new
                    {
                        FieldSpecId = c.Int(nullable: false, identity: true),
                        FieldPosId = c.Int(),
                        ClassId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.FieldSpecId)
                .ForeignKey("dbo.HrmFieldPosition", t => t.FieldPosId)
                .ForeignKey("dbo.hrm_mas_class", t => t.ClassId)
                .Index(t => t.FieldPosId)
                .Index(t => t.ClassId);
            
            CreateTable(
                "dbo.HrmPsEmpEducation",
                c => new
                    {
                        EduId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(),
                        EduDegreeId = c.Int(),
                        EduQualId = c.Int(),
                        EduInsId = c.Int(),
                        EduMajorId = c.Int(),
                        StartDate = c.DateTime(),
                        EduStartYear = c.Int(),
                        EndDate = c.DateTime(),
                        EduEndYear = c.Int(),
                        FundTypeId = c.Int(),
                        Gpa = c.Decimal(precision: 18, scale: 2),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        HrmPsEmployees_EmpId = c.Int(),
                    })
                .PrimaryKey(t => t.EduId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.HrmPsEmployees_EmpId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.MasEduDegree", t => t.EduDegreeId)
                .ForeignKey("dbo.MasEduQualification", t => t.EduQualId)
                .ForeignKey("dbo.MasEduInstitute", t => t.EduInsId)
                .ForeignKey("dbo.MasEduMajor", t => t.EduMajorId)
                .Index(t => t.HrmPsEmployees_EmpId)
                .Index(t => t.EmpId)
                .Index(t => t.EduDegreeId)
                .Index(t => t.EduQualId)
                .Index(t => t.EduInsId)
                .Index(t => t.EduMajorId);
            
            CreateTable(
                "dbo.HrmPsEmpEnglish",
                c => new
                    {
                        EngId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(nullable: false),
                        InsName = c.String(),
                        Remarks = c.String(),
                        DateStart = c.DateTime(),
                        DateEnd = c.DateTime(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        HrmPsEmployees_EmpId = c.Int(),
                    })
                .PrimaryKey(t => t.EngId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.HrmPsEmployees_EmpId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .Index(t => t.HrmPsEmployees_EmpId)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.HrmPsEmpGoodness",
                c => new
                    {
                        GoodNessId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(),
                        GoodNessDescr = c.String(),
                        GoodNessDate = c.DateTime(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.GoodNessId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.HrmPsEmpIncreases",
                c => new
                    {
                        IncreaseId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(),
                        IncreaseName = c.String(),
                        IncreaseRefNo = c.String(),
                        StartDate = c.DateTime(),
                        EndDate = c.DateTime(),
                        CountDate = c.Double(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.IncreaseId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.HrmPsEmpPositionHistory",
                c => new
                    {
                        PosHisId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(),
                        StartDate = c.DateTime(),
                        EndDate = c.DateTime(),
                        CmdDtlsId = c.Int(),
                        CmdRefNo = c.String(),
                        CmdDate = c.DateTime(),
                        CmdName = c.String(),
                        CmdPosRef = c.String(),
                        CmdPosName = c.String(),
                        CmdClassId = c.Int(),
                        CmdClassName = c.String(),
                        CmdJobSiteId = c.Int(),
                        CmdJobSiteName = c.String(),
                        CmdWorkingJobSiteName = c.String(),
                        CmdDepName = c.String(),
                        CmdMisName = c.String(),
                        CmdFieldId = c.Int(),
                        CmdFieldName = c.String(),
                        CmdExecId = c.Int(),
                        CmdExecName = c.String(),
                        CmdSalary = c.Double(),
                        CmdSalaryPosition = c.Double(),
                        Salary = c.Double(),
                        PosRef = c.String(),
                        PosName = c.String(),
                        ClassId = c.Int(),
                        ClassName = c.String(),
                        JobSiteId = c.Int(),
                        JobSiteName = c.String(),
                        MoveId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        CmdTypeId = c.Int(),
                        HisType = c.String(),
                        WorkingJobSiteName = c.String(),
                        DepartmentName = c.String(),
                        MinistryName = c.String(),
                        FieldName = c.String(),
                        ExecName = c.String(),
                    })
                .PrimaryKey(t => t.PosHisId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.HrmPsCommandDtls", t => t.CmdDtlsId)
                .ForeignKey("dbo.hrm_mas_class", t => t.CmdClassId)
                .ForeignKey("dbo.hrm_job_site", t => t.CmdJobSiteId)
                .ForeignKey("dbo.HrmFieldPosition", t => t.CmdFieldId)
                .ForeignKey("dbo.HrmPsCommand", t => t.CmdExecId)
                .ForeignKey("dbo.hrm_mas_class", t => t.ClassId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .ForeignKey("dbo.HrmEsMoveRequest", t => t.MoveId)
                .ForeignKey("dbo.HrmPsCommandType", t => t.CmdTypeId)
                .Index(t => t.EmpId)
                .Index(t => t.CmdDtlsId)
                .Index(t => t.CmdClassId)
                .Index(t => t.CmdJobSiteId)
                .Index(t => t.CmdFieldId)
                .Index(t => t.CmdExecId)
                .Index(t => t.ClassId)
                .Index(t => t.JobSiteId)
                .Index(t => t.MoveId)
                .Index(t => t.CmdTypeId);
            
            CreateTable(
                "dbo.HrmPsEmpNameHistory",
                c => new
                    {
                        NameHisId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(),
                        ChangedRefNo = c.String(),
                        ChangedDate = c.DateTime(),
                        OldPrefixId = c.Int(),
                        OldName = c.String(),
                        OldLastName = c.String(),
                        NewPrefixId = c.Int(),
                        NewName = c.String(),
                        NewLastName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.NameHisId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.OldPrefixId)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.NewPrefixId)
                .Index(t => t.EmpId)
                .Index(t => t.OldPrefixId)
                .Index(t => t.NewPrefixId);
            
            CreateTable(
                "dbo.HrmPsEmpSalaryHistory",
                c => new
                    {
                        SalHisId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(),
                        StartDate = c.DateTime(),
                        EndDate = c.DateTime(),
                        CmdRefNo = c.String(),
                        CmdName = c.String(),
                        CmdDate = c.DateTime(),
                        PosRef = c.String(),
                        PosName = c.String(),
                        ClassId = c.Int(),
                        ClassName = c.String(),
                        JobSiteId = c.Int(),
                        JobSiteName = c.String(),
                        SalaryNew = c.Double(),
                        SalaryOld = c.Double(),
                        SalaryPercentUp = c.Double(),
                        SalaryUp = c.Double(),
                        SalaryMidpoint = c.Double(),
                        SalaryExtra = c.Double(),
                        TotalScore = c.Double(),
                        MoveId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.SalHisId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.HrmMpClass", t => t.ClassId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .ForeignKey("dbo.HrmEsMoveRequest", t => t.MoveId)
                .Index(t => t.EmpId)
                .Index(t => t.ClassId)
                .Index(t => t.JobSiteId)
                .Index(t => t.MoveId);
            
            CreateTable(
                "dbo.HrmPsEmpMovment",
                c => new
                    {
                        MoveId = c.Int(nullable: false, identity: true),
                        EmpTypeId = c.Int(),
                        MoveCode = c.String(),
                        MoveName = c.String(),
                        MoveType = c.String(),
                        MoveSubType = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.MoveId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .Index(t => t.EmpTypeId);
            
            CreateTable(
                "dbo.HrmPsEmpSpouse",
                c => new
                    {
                        SpouseId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(nullable: false),
                        NamePrefixId = c.Int(),
                        SpouseName = c.String(),
                        SpouseLastName = c.String(),
                        EarningStatus = c.String(),
                        SpouseStatus = c.String(),
                        Citizen = c.String(),
                        TaxPayer = c.String(),
                        BirthDate = c.DateTime(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.SpouseId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.NamePrefixId)
                .Index(t => t.EmpId)
                .Index(t => t.NamePrefixId);
            
            CreateTable(
                "dbo.HrmPsEmpChildren",
                c => new
                    {
                        ChildId = c.Int(nullable: false, identity: true),
                        ChildNo = c.Int(nullable: false),
                        EmpId = c.Int(nullable: false),
                        GenderId = c.Int(),
                        NamePrefixId = c.Int(),
                        ChildName = c.String(),
                        ChildLastName = c.String(),
                        BirthDate = c.DateTime(),
                        EduDegreeId = c.Int(),
                        EduInsId = c.Int(),
                        FeeDateEnd = c.DateTime(),
                        FeeEdu = c.String(),
                        ChildStatus = c.String(),
                        EduStatus = c.String(),
                        SpouseId = c.Int(),
                        ChildType = c.String(),
                        Citizen = c.String(),
                        DeathDate = c.DateTime(),
                        DeathRefNo = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        HrmPsEmployees_EmpId = c.Int(),
                    })
                .PrimaryKey(t => t.ChildId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.HrmPsEmployees_EmpId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_mas_gender", t => t.GenderId)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.NamePrefixId)
                .ForeignKey("dbo.MasEduDegree", t => t.EduDegreeId)
                .ForeignKey("dbo.MasEduInstitute", t => t.EduInsId)
                .ForeignKey("dbo.HrmChgSpouse", t => t.SpouseId)
                .Index(t => t.HrmPsEmployees_EmpId)
                .Index(t => t.EmpId)
                .Index(t => t.GenderId)
                .Index(t => t.NamePrefixId)
                .Index(t => t.EduDegreeId)
                .Index(t => t.EduInsId)
                .Index(t => t.SpouseId);
            
            CreateTable(
                "dbo.HrmChgSpouse",
                c => new
                    {
                        ChgSpouseId = c.Int(nullable: false, identity: true),
                        ChgReqId = c.Int(),
                        SpouseId = c.Int(),
                        NamePrefixId = c.Int(),
                        SpouseName = c.String(),
                        SpouseLastName = c.String(),
                        EarningStatus = c.String(),
                        SpouseStatus = c.String(),
                        Citizen = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ChgSpouseId)
                .ForeignKey("dbo.HrmChgRequest", t => t.ChgReqId)
                .ForeignKey("dbo.HrmChgSpouse", t => t.SpouseId)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.NamePrefixId)
                .Index(t => t.ChgReqId)
                .Index(t => t.SpouseId)
                .Index(t => t.NamePrefixId);
            
            CreateTable(
                "dbo.HrmChgRequest",
                c => new
                    {
                        ChgReqId = c.Int(nullable: false, identity: true),
                        ChgTypeId = c.Int(),
                        ChgRefNo = c.String(),
                        ChgDate = c.DateTime(),
                        EmpId = c.Int(),
                        ChgStatus = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ChgReqId)
                .ForeignKey("dbo.ChgTypes", t => t.ChgTypeId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .Index(t => t.ChgTypeId)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.ChgTypes",
                c => new
                    {
                        ChgTypeId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ChgTypeId);
            
            CreateTable(
                "dbo.HrmPsEmpParent",
                c => new
                    {
                        ParentId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(nullable: false),
                        NamePrefixId = c.Int(),
                        ParentName = c.String(),
                        ParentLastName = c.String(),
                        BirthDate = c.DateTime(),
                        ParentType = c.String(),
                        CareStatus = c.String(),
                        ParentStatus = c.String(),
                        Citizen = c.String(),
                        TaxPayer = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ParentId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.NamePrefixId)
                .Index(t => t.EmpId)
                .Index(t => t.NamePrefixId);
            
            CreateTable(
                "dbo.HrmRcInquireSubject",
                c => new
                    {
                        SubjId = c.Int(nullable: false, identity: true),
                        SubjNo = c.String(),
                        Descr = c.String(),
                        Max = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.SubjId);
            
            CreateTable(
                "dbo.HrmMpJobSiteArea",
                c => new
                    {
                        JobSiteAreaId = c.Int(nullable: false, identity: true),
                        JobSiteId = c.Int(),
                        AreaName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.JobSiteAreaId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.HrmMpJobSiteCommand",
                c => new
                    {
                        JobSiteCmdId = c.Int(nullable: false, identity: true),
                        CmdFlag = c.String(),
                        JobSiteTypeId = c.Int(),
                        CmdDraftNo = c.String(),
                        CmdRefNo = c.String(),
                        CmdDescr = c.String(),
                        CmdStatus = c.String(),
                        ApprovedBy = c.Int(),
                        ApprovedName = c.String(),
                        ApprovedDate = c.DateTime(),
                        ApprovedPositions = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.JobSiteCmdId)
                .ForeignKey("dbo.HrmMasJobSiteType", t => t.JobSiteTypeId)
                .Index(t => t.JobSiteTypeId);
            
            CreateTable(
                "dbo.HrmMpJobSiteCommandDtls",
                c => new
                    {
                        JobSiteCmdDtlsId = c.Int(nullable: false, identity: true),
                        JobSiteCmdId = c.Int(nullable: false),
                        CmdDtlsFlag = c.String(),
                        JobSiteId = c.Int(),
                        FromRefNo = c.String(),
                        ToRefNo = c.String(),
                        FromJobSiteName = c.String(),
                        ToJobSiteName = c.String(),
                        FromUpperId = c.Int(),
                        ToUpperId = c.Int(),
                        FromUpperName = c.String(),
                        ToUpperName = c.String(),
                        DateStart = c.DateTime(),
                        OldStartDate = c.DateTime(),
                        NewCmdDate = c.DateTime(),
                        OldCmdDate = c.DateTime(),
                        NewCmdRefNo = c.String(),
                        OldCmdRefNo = c.String(),
                        FromJobSiteLevelId = c.Int(),
                        ToJobSiteLevelId = c.Int(),
                        FromJobDescription = c.String(),
                        ToJobDescription = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        Cancel = c.Int(),
                    })
                .PrimaryKey(t => t.JobSiteCmdDtlsId)
                .ForeignKey("dbo.HrmMpJobSiteCommand", t => t.JobSiteCmdId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .ForeignKey("dbo.hrm_job_site", t => t.FromUpperId)
                .ForeignKey("dbo.hrm_job_site", t => t.ToUpperId)
                .ForeignKey("dbo.HrmMasJobSiteLevel", t => t.FromJobSiteLevelId)
                .ForeignKey("dbo.HrmMasJobSiteLevel", t => t.ToJobSiteLevelId)
                .Index(t => t.JobSiteCmdId)
                .Index(t => t.JobSiteId)
                .Index(t => t.FromUpperId)
                .Index(t => t.ToUpperId)
                .Index(t => t.FromJobSiteLevelId)
                .Index(t => t.ToJobSiteLevelId);
            
            CreateTable(
                "dbo.HrmMpJobSiteType",
                c => new
                    {
                        JobSiteTypeId = c.Int(nullable: false, identity: true),
                        JobSiteTypeName = c.String(),
                        CurrJobSiteId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        current_HrmMpJobSites_JobSiteId = c.Int(),
                    })
                .PrimaryKey(t => t.JobSiteTypeId)
                .ForeignKey("dbo.hrm_job_site", t => t.current_HrmMpJobSites_JobSiteId)
                .ForeignKey("dbo.hrm_job_site", t => t.CurrJobSiteId)
                .Index(t => t.current_HrmMpJobSites_JobSiteId)
                .Index(t => t.CurrJobSiteId);
            
            CreateTable(
                "dbo.HrmMpJobSpecification",
                c => new
                    {
                        JobSpecId = c.Int(nullable: false, identity: true),
                        JobSpecName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.JobSpecId);
            
            CreateTable(
                "dbo.HrmPsEmpLegatee",
                c => new
                    {
                        EmpLegateeId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(nullable: false),
                        LegateeNo = c.Int(nullable: false),
                        NamePrefixId = c.Int(),
                        LegateeName = c.String(),
                        LegateeLastName = c.String(),
                        FamId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EmpLegateeId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.NamePrefixId)
                .ForeignKey("dbo.MasFamilyhood", t => t.FamId)
                .Index(t => t.EmpId)
                .Index(t => t.NamePrefixId)
                .Index(t => t.FamId);
            
            CreateTable(
                "dbo.HrmMpArea",
                c => new
                    {
                        AreaId = c.Int(nullable: false, identity: true),
                        AreaName = c.String(),
                        AreaNameEng = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.AreaId);
            
            CreateTable(
                "dbo.MasCountryZone",
                c => new
                    {
                        ZoneId = c.Int(nullable: false, identity: true),
                        ZoneName = c.String(),
                        ZoneNameEng = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ZoneId);
            
            CreateTable(
                "dbo.MasRecordStatus",
                c => new
                    {
                        RecordId = c.Int(nullable: false, identity: true),
                        RecordStatus = c.String(),
                        RecordStatusName = c.String(),
                        CmdStatusName = c.String(),
                    })
                .PrimaryKey(t => t.RecordId);
            
            CreateTable(
                "dbo.MasRegion",
                c => new
                    {
                        RegionId = c.Int(nullable: false, identity: true),
                        RegionName = c.String(),
                        RegionNameEng = c.String(),
                        CountryId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RegionId)
                .ForeignKey("dbo.HrmMasCountry", t => t.CountryId)
                .Index(t => t.CountryId);
            
            CreateTable(
                "dbo.MasSpecialSkillType",
                c => new
                    {
                        SkillTypeId = c.Int(nullable: false, identity: true),
                        SkillTypeName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.SkillTypeId);
            
            CreateTable(
                "dbo.HrmPsNonWorkingDay",
                c => new
                    {
                        NonWorkingId = c.Int(nullable: false, identity: true),
                        BgYear = c.Int(),
                        NonWorkingDate = c.DateTime(nullable: false),
                        NonWorkingName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.NonWorkingId);
            
            CreateTable(
                "dbo.HrmPsNwdJobSite",
                c => new
                    {
                        NwdJobSiteId = c.Int(nullable: false, identity: true),
                        NonWorkingId = c.Int(),
                        JobSiteId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.NwdJobSiteId)
                .ForeignKey("dbo.HrmPsNonWorkingDay", t => t.NonWorkingId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .Index(t => t.NonWorkingId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.HrmMpPositionDuty",
                c => new
                    {
                        PosDutyId = c.Int(nullable: false, identity: true),
                        PosId = c.Int(),
                        DutyId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PosDutyId)
                .ForeignKey("dbo.hrm_position", t => t.PosId)
                .ForeignKey("dbo.HrmMpDuty", t => t.DutyId)
                .Index(t => t.PosId)
                .Index(t => t.DutyId);
            
            CreateTable(
                "dbo.HrmMpPositionDutyDtls",
                c => new
                    {
                        PosDutyDtlsId = c.Int(nullable: false, identity: true),
                        PosDutyId = c.Int(),
                        SeqNo = c.String(),
                        Descr = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.PosDutyDtlsId)
                .ForeignKey("dbo.HrmMpPositionDuty", t => t.PosDutyId)
                .Index(t => t.PosDutyId);
            
            CreateTable(
                "dbo.HrmPrExtraType",
                c => new
                    {
                        ExtId = c.Int(nullable: false, identity: true),
                        EmpTypeId = c.Int(),
                        ExtCode = c.String(),
                        ExtName = c.String(),
                        ExtNameShort = c.String(),
                        CmdTypeId = c.Int(),
                        ExtFlag = c.String(),
                        ExtTax = c.String(),
                        ExtMonthly = c.String(),
                        ExtAmount = c.Double(),
                        ExtOthCode = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        EditSystem = c.String(),
                        ContactId = c.Int(),
                    })
                .PrimaryKey(t => t.ExtId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .ForeignKey("dbo.HrmPsCommandType", t => t.CmdTypeId)
                .ForeignKey("dbo.IcmMasContact", t => t.ContactId)
                .Index(t => t.EmpTypeId)
                .Index(t => t.CmdTypeId)
                .Index(t => t.ContactId);
            
            CreateTable(
                "dbo.HrmMpPositionStatus",
                c => new
                    {
                        StatusId = c.Int(nullable: false, identity: true),
                        StatusName = c.String(),
                        Empty = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.StatusId);
            
            CreateTable(
                "dbo.HrmRcCatalog",
                c => new
                    {
                        CatId = c.Int(nullable: false, identity: true),
                        BgYear = c.Int(),
                        CatPeriod = c.String(),
                        CatName = c.String(),
                        EmpTypeId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.CatId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .Index(t => t.EmpTypeId);
            
            CreateTable(
                "dbo.HrmRcCatalogStatus",
                c => new
                    {
                        CatStatusId = c.Int(nullable: false, identity: true),
                        CatStatusName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.CatStatusId);
            
            CreateTable(
                "dbo.HrmPsRetirement",
                c => new
                    {
                        RetireId = c.Int(nullable: false, identity: true),
                        EmpTypeId = c.Int(),
                        RetireYear = c.Int(nullable: false),
                        StartDate = c.DateTime(),
                        JobSiteId = c.Int(),
                        RefNo = c.String(),
                        RetireTitle = c.String(),
                        RetireDescr = c.String(),
                        ApprovedDate = c.DateTime(),
                        ApprovedName = c.String(),
                        ApprovedPosition = c.String(),
                        RetireStatus = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RetireId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .Index(t => t.EmpTypeId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.HrmPsRetirementDtls",
                c => new
                    {
                        RetireDtlsId = c.Int(nullable: false, identity: true),
                        RetireId = c.Int(),
                        EmpId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RetireDtlsId)
                .ForeignKey("dbo.HrmPsRetirement", t => t.RetireId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .Index(t => t.RetireId)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.HrmPsRoyalItemControl",
                c => new
                    {
                        CtrlId = c.Long(nullable: false, identity: true),
                        EmpId = c.Int(),
                        ReturnDate = c.DateTime(),
                        Amount = c.Double(),
                        RoyalItemId = c.Int(),
                        GetDate = c.DateTime(),
                        ReturnFlag = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.CtrlId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.HrmPsRoyalItem", t => t.RoyalItemId)
                .Index(t => t.EmpId)
                .Index(t => t.RoyalItemId);
            
            CreateTable(
                "dbo.HrmPsRoyalItem",
                c => new
                    {
                        RoyalItemId = c.Int(nullable: false, identity: true),
                        RoyalItemTypeId = c.Int(),
                        RoyalItemCode = c.String(),
                        RoyalItemName = c.String(),
                        RoyalItemNameShort = c.String(),
                        RoyalItemLevel = c.String(),
                        RoyalItemGroup = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RoyalItemId)
                .ForeignKey("dbo.HrmPsRoyalItemType", t => t.RoyalItemTypeId)
                .Index(t => t.RoyalItemTypeId);
            
            CreateTable(
                "dbo.HrmPsRoyalItemType",
                c => new
                    {
                        RoyalItemTypeId = c.Int(nullable: false, identity: true),
                        RoyalItemTypeCode = c.String(),
                        RoyalItemTypeName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RoyalItemTypeId);
            
            CreateTable(
                "dbo.HrmPsRoyalItemHistory",
                c => new
                    {
                        RoyalItemHisId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(),
                        RoyalItemReqId = c.Int(),
                        RoyalItemId = c.Int(),
                        ReceivedDate = c.DateTime(),
                        PosRef = c.String(),
                        PosName = c.String(),
                        ClassName = c.String(),
                        Salary = c.Double(),
                        JobSiteName = c.String(),
                        GazetteNo1 = c.String(),
                        GazetteNo2 = c.String(),
                        GazetteNo3 = c.String(),
                        GazetteNo4 = c.String(),
                        GazetteNo5 = c.String(),
                        GazetteDate = c.DateTime(),
                        GetDate = c.DateTime(),
                        ReturnFlag = c.String(),
                        ReturnDate = c.DateTime(),
                        ReturnAmount = c.Double(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RoyalItemHisId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.HrmPsRoyalItemRequest", t => t.RoyalItemReqId)
                .ForeignKey("dbo.HrmPsRoyalItem", t => t.RoyalItemId)
                .Index(t => t.EmpId)
                .Index(t => t.RoyalItemReqId)
                .Index(t => t.RoyalItemId);
            
            CreateTable(
                "dbo.HrmPsRoyalItemRequest",
                c => new
                    {
                        ReqId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(),
                        ReqYear = c.Decimal(precision: 18, scale: 2),
                        RoyalItemId = c.Int(),
                        CurrRoyalItemId = c.Int(),
                        PosId = c.Int(),
                        ClassId = c.Int(),
                        JobSiteId = c.Int(),
                        Salary = c.Double(),
                        Need = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ReqId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.HrmPsRoyalItem", t => t.RoyalItemId)
                .ForeignKey("dbo.HrmPsRoyalItem", t => t.CurrRoyalItemId)
                .ForeignKey("dbo.hrm_position", t => t.PosId)
                .ForeignKey("dbo.hrm_mas_class", t => t.ClassId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .Index(t => t.EmpId)
                .Index(t => t.RoyalItemId)
                .Index(t => t.CurrRoyalItemId)
                .Index(t => t.PosId)
                .Index(t => t.ClassId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.HrmPsRoyalItemRepay",
                c => new
                    {
                        RepayId = c.Int(nullable: false, identity: true),
                        RefNo = c.String(),
                        RepayDescr = c.String(),
                        StartDate = c.DateTime(),
                        EndDate = c.DateTime(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RepayId);
            
            CreateTable(
                "dbo.HrmPsRoyalItemRepayDtls",
                c => new
                    {
                        RepayDtlsId = c.Int(nullable: false, identity: true),
                        RepayId = c.Int(),
                        RoyalItemId = c.Int(),
                        GenderId = c.Int(),
                        Amount = c.Double(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RepayDtlsId)
                .ForeignKey("dbo.HrmPsRoyalItemRepay", t => t.RepayId)
                .ForeignKey("dbo.HrmPsRoyalItem", t => t.RoyalItemId)
                .ForeignKey("dbo.hrm_mas_gender", t => t.GenderId)
                .Index(t => t.RepayId)
                .Index(t => t.RoyalItemId)
                .Index(t => t.GenderId);
            
            CreateTable(
                "dbo.HrmPrSalaryGroup",
                c => new
                    {
                        SalGrpId = c.Int(nullable: false, identity: true),
                        SalGrpDescr = c.String(),
                        EmpTypeId = c.Int(),
                        PosTypeId = c.Int(),
                        ClassId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.SalGrpId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .ForeignKey("dbo.HrmMasPositionType", t => t.PosTypeId)
                .ForeignKey("dbo.hrm_mas_class", t => t.ClassId)
                .Index(t => t.EmpTypeId)
                .Index(t => t.PosTypeId)
                .Index(t => t.ClassId);
            
            CreateTable(
                "dbo.HrmScUser",
                c => new
                    {
                        ScUserId = c.Int(nullable: false, identity: true),
                        ScEmpId = c.Int(),
                        JobSiteId = c.Int(),
                        ScUserDescr = c.String(),
                        ScUserPassword = c.String(),
                        ScInitialPassword = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ScUserId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.ScEmpId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .Index(t => t.ScEmpId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.HrmPsEmpSpecialExpert",
                c => new
                    {
                        EmpExpId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(nullable: false),
                        ExpDescr = c.String(),
                        Remarks = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EmpExpId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.HrmPsEmpSpecialSkill",
                c => new
                    {
                        SkillId = c.Int(nullable: false, identity: true),
                        EmpId = c.Int(nullable: false),
                        SkillTypeId = c.Int(),
                        SkillDescr = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.SkillId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.MasSkillType", t => t.SkillTypeId)
                .Index(t => t.EmpId)
                .Index(t => t.SkillTypeId);
            
            CreateTable(
                "dbo.HrmPsTimeAttendant",
                c => new
                    {
                        WorkingId = c.Int(nullable: false, identity: true),
                        WorkingDate = c.DateTime(),
                        EmpId = c.Int(),
                        WorkingStatus = c.String(),
                        WorkingStart = c.Time(),
                        WorkingEnd = c.Time(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.WorkingId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.HrmTrainingRequest",
                c => new
                    {
                        RequestId = c.Int(nullable: false, identity: true),
                        TrainingCurDescr = c.String(),
                        DateTraining = c.DateTime(),
                        TrainingPlace = c.String(),
                        TrainingCreate = c.String(),
                        Remarks = c.String(),
                        EmpId = c.Int(nullable: false),
                        RequestedWhen = c.DateTime(),
                        StatusId = c.Int(nullable: false),
                        UpdatedBy = c.String(),
                        UpdatedWhen = c.DateTime(),
                        RecordStatus = c.String(),
                    })
                .PrimaryKey(t => t.RequestId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.HrmDcStatus", t => t.StatusId, cascadeDelete: true)
                .Index(t => t.EmpId)
                .Index(t => t.StatusId);
            
            CreateTable(
                "dbo.HrmDcStatus",
                c => new
                    {
                        StatId = c.Int(nullable: false, identity: true),
                        StatName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.StatId);
            
            CreateTable(
                "dbo.HrmTrainingTypeCategory",
                c => new
                    {
                        TrainingCatId = c.Int(nullable: false, identity: true),
                        TrainingCatDescr = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdateWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TrainingCatId);
            
            CreateTable(
                "dbo.HrmTrainingCourse",
                c => new
                    {
                        TrainId = c.Long(nullable: false, identity: true),
                        RefNo = c.String(),
                        TrainingCourseDescr = c.String(),
                        TrainingCurId = c.Int(),
                        DateSignStart = c.DateTime(),
                        DateSignEnd = c.DateTime(),
                        TimeSignEnd = c.Time(),
                        DateTrainingStart = c.DateTime(),
                        DateTrainingEnd = c.DateTime(),
                        ScheduleText = c.String(),
                        MaxTraineeCount = c.Decimal(precision: 18, scale: 2),
                        UnitPrice = c.Decimal(precision: 18, scale: 2),
                        TotalScore = c.Decimal(precision: 18, scale: 2),
                        ScoreVeryGood = c.Decimal(precision: 18, scale: 2),
                        ScoreGood = c.Decimal(precision: 18, scale: 2),
                        ScoreAcceptable = c.Decimal(precision: 18, scale: 2),
                        ScoreType = c.Decimal(nullable: false, precision: 18, scale: 2),
                        EmpSecId = c.Int(),
                        Closed = c.Decimal(precision: 18, scale: 2),
                        ScholarFundId = c.Int(),
                        EpcId = c.Int(),
                        TrainingInsId = c.Int(),
                        Remarks = c.String(),
                        TotalCost = c.Decimal(precision: 18, scale: 2),
                        CountryId = c.Int(),
                        TrainingGroupId = c.Int(),
                        TotalHours = c.Decimal(precision: 18, scale: 2),
                        OrgText = c.String(),
                        BgSourceId = c.Int(),
                        TotalPrice = c.Decimal(precision: 18, scale: 2),
                        RecordStatus = c.String(),
                        CreatedBy = c.String(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.String(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TrainId)
                .ForeignKey("dbo.HrmTrainingCurriculum", t => t.TrainingCurId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpSecId)
                .ForeignKey("dbo.HrmScholarshipFund", t => t.ScholarFundId)
                .ForeignKey("dbo.hrm_executive_position", t => t.EpcId)
                .ForeignKey("dbo.HrmTrainingInstitute", t => t.TrainingInsId)
                .ForeignKey("dbo.HrmMasCountry", t => t.CountryId)
                .ForeignKey("dbo.HrmTrainingGroup", t => t.TrainingGroupId)
                .ForeignKey("dbo.bgm_mas_source", t => t.BgSourceId)
                .Index(t => t.TrainingCurId)
                .Index(t => t.EmpSecId)
                .Index(t => t.ScholarFundId)
                .Index(t => t.EpcId)
                .Index(t => t.TrainingInsId)
                .Index(t => t.CountryId)
                .Index(t => t.TrainingGroupId)
                .Index(t => t.BgSourceId);
            
            CreateTable(
                "dbo.HrmTrainingCurriculum",
                c => new
                    {
                        TrainingCurId = c.Int(nullable: false, identity: true),
                        TrainingCurDescr = c.String(),
                        Details = c.String(),
                        ComparableGroup = c.String(),
                        TrainingTypeId = c.Int(nullable: false),
                        DefaultTotalHours = c.Decimal(precision: 18, scale: 2),
                        RecordStatus = c.String(),
                        CreatedBy = c.String(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.String(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TrainingCurId)
                .ForeignKey("dbo.HrmTrainingType", t => t.TrainingTypeId, cascadeDelete: true)
                .Index(t => t.TrainingTypeId);
            
            CreateTable(
                "dbo.HrmTrainingType",
                c => new
                    {
                        TrainingTypeId = c.Int(nullable: false, identity: true),
                        TrainingTypeDescr = c.String(),
                        TrainingCatId = c.Int(nullable: false),
                        _internal = c.Decimal(name: "internal", precision: 18, scale: 2),
                        Local = c.Decimal(precision: 18, scale: 2),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TrainingTypeId)
                .ForeignKey("dbo.HrmTrainingTypeCategory", t => t.TrainingCatId, cascadeDelete: true)
                .Index(t => t.TrainingCatId);
            
            CreateTable(
                "dbo.HrmScholarshipFund",
                c => new
                    {
                        ScholarFundId = c.Int(nullable: false, identity: true),
                        ScholarFundDescr = c.String(),
                        ScholarTypeId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ScholarFundId)
                .ForeignKey("dbo.HrmScholarshipType", t => t.ScholarTypeId)
                .Index(t => t.ScholarTypeId);
            
            CreateTable(
                "dbo.HrmScholarshipType",
                c => new
                    {
                        ScholarTypeId = c.Int(nullable: false, identity: true),
                        ScholarTypeDescr = c.String(),
                        ScholarLocal = c.Decimal(precision: 18, scale: 2),
                        EduTimeType = c.Decimal(precision: 18, scale: 2),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ScholarTypeId);
            
            CreateTable(
                "dbo.HrmTrainingInstitute",
                c => new
                    {
                        TrainingInsId = c.Int(nullable: false, identity: true),
                        TrainingInsDescr = c.String(),
                        TrainingInsResponsible = c.String(),
                        CountryId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TrainingInsId)
                .ForeignKey("dbo.HrmMasCountry", t => t.CountryId)
                .Index(t => t.CountryId);
            
            CreateTable(
                "dbo.HrmTrainingGroup",
                c => new
                    {
                        TrainingGroupId = c.Int(nullable: false, identity: true),
                        TrainingGroupDescr = c.String(),
                        _internal = c.Decimal(name: "internal", precision: 18, scale: 2),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdateWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TrainingGroupId);
            
            CreateTable(
                "dbo.HrmTrainingCourseTrainee",
                c => new
                    {
                        TraineeId = c.Int(nullable: false, identity: true),
                        TrainId = c.Int(),
                        EmpId = c.Int(),
                        Score = c.Decimal(precision: 18, scale: 2),
                        ScoredBy = c.String(),
                        ScoredWhen = c.DateTime(),
                        ResultMemo = c.String(),
                        Granted = c.Decimal(precision: 18, scale: 2),
                        TrainHour = c.Decimal(precision: 18, scale: 2),
                        TraineeText = c.String(),
                        OrgText = c.String(),
                        JobSiteId = c.Int(),
                        WorkingText = c.String(),
                        PositionText = c.String(),
                        ClassText = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.String(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.String(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TraineeId)
                .ForeignKey("dbo.HrmTrainingRequest", t => t.TrainId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .Index(t => t.TrainId)
                .Index(t => t.EmpId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.HrmTrainingCourseQuota",
                c => new
                    {
                        CourseQuotaId = c.Int(nullable: false, identity: true),
                        TrainId = c.Int(nullable: false),
                        JobSiteId = c.Int(nullable: false),
                        Quota = c.Decimal(nullable: false, precision: 18, scale: 2),
                        RecordStatus = c.String(),
                        CreatedBy = c.String(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.String(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.CourseQuotaId)
                .ForeignKey("dbo.HrmTrainingRequest", t => t.TrainId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId, cascadeDelete: true)
                .Index(t => t.TrainId)
                .Index(t => t.JobSiteId);
            
            CreateTable(
                "dbo.HrmTrainingCourseTrainer",
                c => new
                    {
                        CourseTrainerId = c.Int(nullable: false, identity: true),
                        TrainId = c.Int(nullable: false),
                        TrainerId = c.Int(),
                        TrainingSubjectId = c.Int(),
                        TrainingSubjectDtlsId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.CourseTrainerId)
                .ForeignKey("dbo.HrmTrainingRequest", t => t.TrainId, cascadeDelete: true)
                .ForeignKey("dbo.HrmTrainer", t => t.TrainerId)
                .ForeignKey("dbo.HrmTrainingSubject", t => t.TrainingSubjectId)
                .ForeignKey("dbo.HrmTrainingSubjectDtls", t => t.TrainingSubjectDtlsId)
                .Index(t => t.TrainId)
                .Index(t => t.TrainerId)
                .Index(t => t.TrainingSubjectId)
                .Index(t => t.TrainingSubjectDtlsId);
            
            CreateTable(
                "dbo.HrmTrainer",
                c => new
                    {
                        TrainerId = c.Int(nullable: false, identity: true),
                        NamePrefixId = c.Int(),
                        FirstNameLocal = c.String(),
                        LastNameLocal = c.String(),
                        EmpId = c.Int(),
                        Active = c.Decimal(nullable: false, precision: 18, scale: 2),
                        Address = c.String(),
                        PostalCode = c.String(),
                        Tel = c.String(),
                        Email = c.String(),
                        Website = c.String(),
                        Citizen = c.String(),
                        DistrictId = c.Int(),
                        RecordStatus = c.String(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TrainerId)
                .ForeignKey("dbo.HrmMasNamePrefix", t => t.NamePrefixId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .ForeignKey("dbo.HrmMasDistrict", t => t.DistrictId)
                .Index(t => t.NamePrefixId)
                .Index(t => t.EmpId)
                .Index(t => t.DistrictId);
            
            CreateTable(
                "dbo.HrmTrainingSubject",
                c => new
                    {
                        TrainingSubjectId = c.Int(nullable: false, identity: true),
                        TrainingSubjectDescr = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TrainingSubjectId);
            
            CreateTable(
                "dbo.HrmTrainingSubjectDtls",
                c => new
                    {
                        TrainingSubjectDtlsId = c.Int(nullable: false, identity: true),
                        TrainingSubjectId = c.Int(nullable: false),
                        TopicDescr = c.String(),
                        Detail = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TrainingSubjectDtlsId)
                .ForeignKey("dbo.HrmTrainingSubject", t => t.TrainingSubjectId, cascadeDelete: true)
                .Index(t => t.TrainingSubjectId);
            
            CreateTable(
                "dbo.HrmScholarship",
                c => new
                    {
                        ScholarId = c.Int(nullable: false, identity: true),
                        ScholarDescr = c.String(),
                        ScholarTypeId = c.Int(nullable: false),
                        ScholarFundId = c.Int(nullable: false),
                        ScholarFundSeq2 = c.Int(),
                        EduDegreeId = c.Int(nullable: false),
                        CountryId = c.Int(nullable: false),
                        Amount = c.Decimal(nullable: false, precision: 18, scale: 2),
                        Closed = c.Decimal(nullable: false, precision: 18, scale: 2),
                        DateSignStart = c.DateTime(),
                        DateSignEnd = c.DateTime(),
                        TimeStart = c.Time(),
                        TimeEnd = c.Time(),
                        EduYearEnd = c.String(),
                        EduYearStart = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ScholarId)
                .ForeignKey("dbo.HrmScholarshipType", t => t.ScholarTypeId, cascadeDelete: true)
                .ForeignKey("dbo.HrmScholarshipFund", t => t.ScholarFundId, cascadeDelete: true)
                .ForeignKey("dbo.MasEduDegree", t => t.EduDegreeId, cascadeDelete: true)
                .ForeignKey("dbo.HrmMasCountry", t => t.CountryId, cascadeDelete: true)
                .Index(t => t.ScholarTypeId)
                .Index(t => t.ScholarFundId)
                .Index(t => t.EduDegreeId)
                .Index(t => t.CountryId);
            
            CreateTable(
                "dbo.HrmScholarshipGroup",
                c => new
                    {
                        ScholarGroupId = c.Int(nullable: false, identity: true),
                        ScholarGroupDescr = c.String(),
                        Amount = c.Decimal(precision: 18, scale: 2),
                        ScholarId = c.Int(nullable: false),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ScholarGroupId)
                .ForeignKey("dbo.HrmScholarship", t => t.ScholarId, cascadeDelete: true)
                .Index(t => t.ScholarId);
            
            CreateTable(
                "dbo.HrmScholarshipGroupDtls",
                c => new
                    {
                        ScholarGroupId = c.Int(nullable: false, identity: true),
                        SeqNo = c.Decimal(nullable: false, precision: 18, scale: 2),
                        EduMajorId = c.Int(nullable: false),
                        ScholarId = c.Int(nullable: false),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ScholarGroupId)
                .ForeignKey("dbo.MasEduMajor", t => t.EduMajorId, cascadeDelete: true)
                .ForeignKey("dbo.HrmScholarship", t => t.ScholarId, cascadeDelete: true)
                .Index(t => t.EduMajorId)
                .Index(t => t.ScholarId);
            
            CreateTable(
                "dbo.HrmScholarshipRequest",
                c => new
                    {
                        TranId = c.Int(nullable: false, identity: true),
                        TranDate = c.DateTime(nullable: false),
                        EmpId = c.Int(nullable: false),
                        ScholarId = c.Int(nullable: false),
                        EduInsId = c.Int(),
                        DateStart = c.DateTime(),
                        DateEnd = c.DateTime(),
                        Granted = c.Decimal(nullable: false, precision: 18, scale: 2),
                        EduMajorId = c.Int(),
                        EduResultPassed = c.Decimal(precision: 18, scale: 2),
                        EduResultGpa = c.Decimal(precision: 18, scale: 2),
                        GetSalary = c.Decimal(nullable: false, precision: 18, scale: 2),
                        ApDescr = c.String(),
                        ApFhId = c.Int(nullable: false),
                        ApCitizenId = c.Int(nullable: false),
                        ApCareer = c.String(),
                        ApCareerPosition = c.String(),
                        ApContactAddress = c.String(),
                        ApContactDistrictId = c.Int(nullable: false),
                        ApContactPostalCode = c.String(),
                        ApContactTel = c.String(),
                        ApDateSigned = c.DateTime(),
                        ApDateAssured = c.DateTime(),
                        AssureRefNo = c.String(),
                        EpcCompareResultNo = c.Decimal(precision: 18, scale: 2),
                        AmountRepay = c.Decimal(precision: 18, scale: 2),
                        AmountRepayReal = c.Decimal(precision: 18, scale: 2),
                        RepayMoney = c.Decimal(precision: 18, scale: 2),
                        ContractNo = c.String(),
                        Remarks = c.String(),
                        GetPositionCost = c.Decimal(precision: 18, scale: 2),
                        EduQualId = c.Int(nullable: false),
                        TeacherName = c.String(),
                        ResponseDate = c.DateTime(),
                        ResponseNo = c.String(),
                        TeacherTel = c.String(),
                        TeacherFax = c.String(),
                        DurationYear = c.Decimal(precision: 18, scale: 2),
                        DurationMonth = c.Decimal(precision: 18, scale: 2),
                        EntranceDescr = c.String(),
                        AmountRequest = c.Decimal(precision: 18, scale: 2),
                        AmountApprove = c.Decimal(precision: 18, scale: 2),
                        ResponseTypeId = c.Int(),
                        EduResultRemarks = c.String(),
                        DocNo = c.String(),
                        ScholarGroupId = c.Int(),
                        StatusCancel = c.String(),
                        StatusCancelRemarks = c.String(),
                        StatusReturn = c.String(),
                        StatusReturnRemarks = c.String(),
                        StatusTransfer = c.String(),
                        StatusTransferRemarks = c.String(),
                        StatusRepay = c.String(),
                        StatusRepayRemarks = c.String(),
                        StatusComplete = c.String(),
                        StatusCompleteRemarks = c.String(),
                        EduProvDescr = c.String(),
                        ProjectDescr = c.String(),
                        FacultyDescr = c.String(),
                        DepartmentDescr = c.String(),
                        EmpText = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.TranId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .ForeignKey("dbo.HrmScholarship", t => t.ScholarId, cascadeDelete: true)
                .ForeignKey("dbo.HrmPsEmpEducation", t => t.EduInsId)
                .ForeignKey("dbo.MasEduMajor", t => t.EduMajorId)
                .ForeignKey("dbo.HrmAprAppraisal", t => t.ApFhId, cascadeDelete: true)
                .ForeignKey("dbo.HrmScholarshipRequest", t => t.ApCitizenId)
                .ForeignKey("dbo.HrmMasDistrict", t => t.ApContactDistrictId, cascadeDelete: true)
                .ForeignKey("dbo.MasEduQualification", t => t.EduQualId, cascadeDelete: true)
                .ForeignKey("dbo.HrmEsResponse", t => t.ResponseTypeId)
                .ForeignKey("dbo.HrmScholarshipGroup", t => t.ScholarGroupId)
                .Index(t => t.EmpId)
                .Index(t => t.ScholarId)
                .Index(t => t.EduInsId)
                .Index(t => t.EduMajorId)
                .Index(t => t.ApFhId)
                .Index(t => t.ApCitizenId)
                .Index(t => t.ApContactDistrictId)
                .Index(t => t.EduQualId)
                .Index(t => t.ResponseTypeId)
                .Index(t => t.ScholarGroupId);
            
            CreateTable(
                "dbo.HrmAprAppraisal",
                c => new
                    {
                        AprId = c.Int(nullable: false, identity: true),
                        AprYear = c.Int(),
                        AprPeriod = c.Int(),
                        AprName = c.String(),
                        EmpTypeId = c.Int(),
                        ActStartDate = c.DateTime(),
                        ActEndDate = c.DateTime(),
                        AprStartDate = c.DateTime(),
                        AprEndDate = c.DateTime(),
                        StdScoreId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.AprId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId)
                .ForeignKey("dbo.HrmAppraisalStdScore", t => t.StdScoreId)
                .Index(t => t.EmpTypeId)
                .Index(t => t.StdScoreId);
            
            CreateTable(
                "dbo.HrmAppraisalStdScore",
                c => new
                    {
                        StdScoreId = c.Int(nullable: false, identity: true),
                        StdScoreName = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.StdScoreId);
            
            CreateTable(
                "dbo.HrmEsResponse",
                c => new
                    {
                        RespId = c.Int(nullable: false, identity: true),
                        MailId = c.Int(),
                        RespStatus = c.String(),
                        Descr = c.String(),
                        RespNextId = c.Int(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RespId)
                .ForeignKey("dbo.HrmEsMail", t => t.MailId)
                .ForeignKey("dbo.HrmEsResponse", t => t.RespNextId)
                .Index(t => t.MailId)
                .Index(t => t.RespNextId);
            
            CreateTable(
                "dbo.HrmEsMail",
                c => new
                    {
                        MailId = c.Int(nullable: false, identity: true),
                        MailTypeId = c.Int(),
                        SenderId = c.Int(),
                        ReceiverId = c.Int(),
                        ReqId = c.Int(),
                        Descr = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.MailId)
                .ForeignKey("dbo.HrmEsMail", t => t.MailTypeId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.SenderId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.ReceiverId)
                .ForeignKey("dbo.bgm_request", t => t.ReqId)
                .Index(t => t.MailTypeId)
                .Index(t => t.SenderId)
                .Index(t => t.ReceiverId)
                .Index(t => t.ReqId);
            
            CreateTable(
                "dbo.bgm_request",
                c => new
                    {
                        bgm_req_seq = c.Int(nullable: false, identity: true),
                        bgm_req_code = c.String(storeType: "ntext"),
                        bgm_req_name = c.String(storeType: "ntext"),
                        bgm_req_descr = c.String(storeType: "ntext"),
                        bgm_req_manager = c.Int(),
                        bgm_req_scope = c.Int(),
                        bgm_req_date = c.DateTime(storeType: "datetime2"),
                        bgm_req_reason = c.String(storeType: "ntext"),
                        bgm_req_object = c.String(storeType: "ntext"),
                        bgm_req_target = c.String(storeType: "ntext"),
                        bgm_req_plan = c.String(storeType: "ntext"),
                        bgm_req_remark = c.String(storeType: "ntext"),
                        bgm_strat_list_seq = c.Int(),
                        prj_type_seq = c.Int(),
                        job_site_seq = c.Int(),
                        job_site_seq_main = c.Int(),
                        bgm_year = c.Int(),
                        date_start = c.DateTime(storeType: "datetime2"),
                        date_end = c.DateTime(storeType: "datetime2"),
                        record_status = c.String(storeType: "ntext"),
                        created_by = c.Int(),
                        created_when = c.DateTime(storeType: "datetime2"),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(storeType: "datetime2"),
                    })
                .PrimaryKey(t => t.bgm_req_seq)
                .ForeignKey("dbo.bgm_strategy_data_list", t => t.bgm_strat_list_seq)
                .ForeignKey("dbo.bgm_project_type", t => t.prj_type_seq)
                .ForeignKey("dbo.hrm_job_site", t => t.job_site_seq)
                .Index(t => t.bgm_strat_list_seq)
                .Index(t => t.prj_type_seq)
                .Index(t => t.job_site_seq);
            
            CreateTable(
                "dbo.HrmPsAbsence",
                c => new
                    {
                        AbsenceId = c.Int(nullable: false, identity: true),
                        AbsenceTypeId = c.Int(),
                        BgYear = c.Int(),
                        EmpId = c.Int(),
                        StartDate = c.DateTime(),
                        StartTime = c.String(),
                        EndDate = c.DateTime(),
                        EndTime = c.String(),
                        DayCount = c.Decimal(precision: 18, scale: 2),
                        ContactAddress = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        Description = c.String(),
                    })
                .PrimaryKey(t => t.AbsenceId)
                .ForeignKey("dbo.HrmPsAbsenceType", t => t.AbsenceTypeId)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId)
                .Index(t => t.AbsenceTypeId)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.HrmPsAbsenceType",
                c => new
                    {
                        AbsenceTypeId = c.Int(nullable: false, identity: true),
                        AbsenceTypeName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.AbsenceTypeId);
            
            CreateTable(
                "dbo.HrmPsAbsenceRule",
                c => new
                    {
                        RuleId = c.Int(nullable: false, identity: true),
                        EmpTypeId = c.Int(nullable: false),
                        AbsenceTypeId = c.Int(nullable: false),
                        QuotaDay = c.Decimal(precision: 18, scale: 2),
                        QuotaSalary = c.Decimal(precision: 18, scale: 2),
                        QuotaCount = c.Decimal(precision: 18, scale: 2),
                        QuotaDayCount = c.Decimal(precision: 18, scale: 2),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.RuleId)
                .ForeignKey("dbo.hrm_mas_employee_type", t => t.EmpTypeId, cascadeDelete: true)
                .ForeignKey("dbo.HrmPsAbsenceType", t => t.AbsenceTypeId, cascadeDelete: true)
                .Index(t => t.EmpTypeId)
                .Index(t => t.AbsenceTypeId);
            
            CreateTable(
                "dbo.HrmPsAbsenceTypeGroup",
                c => new
                    {
                        AbsenceTypeGroupId = c.Int(nullable: false, identity: true),
                        AbsenceTypeGroupName = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.AbsenceTypeGroupId);
            
            CreateTable(
                "dbo.HrmActivity",
                c => new
                    {
                        ActId = c.Int(nullable: false, identity: true),
                        BgmProjOperId = c.Int(),
                        ActDescr = c.String(),
                        ActTypeId = c.Int(nullable: false),
                        JobSiteId = c.Int(),
                        CityId = c.Int(),
                        LocationText = c.String(),
                        ActLimit = c.Decimal(precision: 18, scale: 2),
                        DateSignStart = c.DateTime(),
                        DateSignEnd = c.DateTime(),
                        TimeSignEnd = c.Time(),
                        DateActivityStart = c.DateTime(),
                        DateActivityEnd = c.DateTime(),
                        DateAppStart = c.DateTime(),
                        DateAppEnd = c.DateTime(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.String(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.String(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ActId)
                .ForeignKey("dbo.bgm_project_operation", t => t.BgmProjOperId)
                .ForeignKey("dbo.HrmActivityType", t => t.ActTypeId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_job_site", t => t.JobSiteId)
                .ForeignKey("dbo.HrmMasCity", t => t.CityId)
                .Index(t => t.BgmProjOperId)
                .Index(t => t.ActTypeId)
                .Index(t => t.JobSiteId)
                .Index(t => t.CityId);
            
            CreateTable(
                "dbo.HrmActivityType",
                c => new
                    {
                        ActTypeId = c.Int(nullable: false, identity: true),
                        ActTypeDescr = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                        Remark = c.String(),
                    })
                .PrimaryKey(t => t.ActTypeId);
            
            CreateTable(
                "dbo.HrmActivityRequest",
                c => new
                    {
                        ActRequestId = c.Int(nullable: false, identity: true),
                        ActId = c.Int(nullable: false),
                        EmpId = c.Int(nullable: false),
                        Granted = c.Decimal(precision: 18, scale: 2),
                        ActRequestStatus = c.String(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.ActRequestId)
                .ForeignKey("dbo.HrmActivity", t => t.ActId, cascadeDelete: true)
                .ForeignKey("dbo.hrm_ps_employees", t => t.EmpId, cascadeDelete: true)
                .Index(t => t.ActId)
                .Index(t => t.EmpId);
            
            CreateTable(
                "dbo.rule_absence",
                c => new
                    {
                        rule_absence_seq = c.Int(nullable: false, identity: true),
                        emp_type_seq = c.Int(nullable: false),
                        absence_type_seq = c.Int(nullable: false),
                        send_before = c.Int(),
                        include_nwd = c.String(),
                        day_limit = c.Decimal(precision: 18, scale: 2),
                        day_limit_full_salary = c.Decimal(precision: 18, scale: 2),
                        day_limit_half_salary = c.Decimal(precision: 18, scale: 2),
                        time_limit = c.Decimal(precision: 18, scale: 2),
                        day_per_time_limit = c.Decimal(precision: 18, scale: 2),
                        rule_approve_type_seq = c.Int(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_absence_seq);
            
            CreateTable(
                "dbo.rule_approve",
                c => new
                    {
                        rule_approve_seq = c.Int(nullable: false, identity: true),
                        rule_approve_type_seq = c.Int(),
                        step = c.Int(),
                        approver_type = c.String(),
                        approver_seq = c.Int(),
                        action = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_approve_seq);
            
            CreateTable(
                "dbo.rule_approve_custom_button",
                c => new
                    {
                        rule_approve_custom_seq = c.Int(nullable: false, identity: true),
                        rule_approve_group_seq = c.Int(nullable: false),
                        rule_approve_custom_name = c.String(),
                        navigate_url = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_approve_custom_seq);
            
            CreateTable(
                "dbo.rule_approve_group",
                c => new
                    {
                        rule_approve_group_seq = c.Int(nullable: false, identity: true),
                        rule_approve_group_name = c.String(),
                        ref_to_database = c.String(),
                        ref_to_table_name = c.String(),
                        ref_column_seq_name = c.String(),
                        ref_action_name = c.String(),
                        ref_controller_name = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_approve_group_seq);
            
            CreateTable(
                "dbo.tablename",
                c => new
                    {
                        rule_approve_type_seq = c.Int(nullable: false, identity: true),
                        rule_approve_group_seq = c.Int(),
                        rule_approve_type_name = c.String(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_approve_type_seq)
                .ForeignKey("dbo.rule_approve_group", t => t.rule_approve_group_seq)
                .Index(t => t.rule_approve_group_seq);
            
            AddColumn("dbo.hrm_job_site", "MpJobSiteType_JobSiteTypeId", c => c.Int());
            AddForeignKey("dbo.hrm_job_site", "MpJobSiteType_JobSiteTypeId", "dbo.HrmMpJobSiteType", "JobSiteTypeId");
            AddForeignKey("dbo.HrmFieldPosition", "ClassSpecId", "dbo.HrmMasClassSpecification", "ClassSpecId");
            CreateIndex("dbo.hrm_job_site", "MpJobSiteType_JobSiteTypeId");
            CreateIndex("dbo.HrmFieldPosition", "ClassSpecId");
        }
        
        public override void Down()
        {
            DropIndex("dbo.tablename", new[] { "rule_approve_group_seq" });
            DropIndex("dbo.HrmActivityRequest", new[] { "EmpId" });
            DropIndex("dbo.HrmActivityRequest", new[] { "ActId" });
            DropIndex("dbo.HrmActivity", new[] { "CityId" });
            DropIndex("dbo.HrmActivity", new[] { "JobSiteId" });
            DropIndex("dbo.HrmActivity", new[] { "ActTypeId" });
            DropIndex("dbo.HrmActivity", new[] { "BgmProjOperId" });
            DropIndex("dbo.HrmPsAbsenceRule", new[] { "AbsenceTypeId" });
            DropIndex("dbo.HrmPsAbsenceRule", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmPsAbsence", new[] { "EmpId" });
            DropIndex("dbo.HrmPsAbsence", new[] { "AbsenceTypeId" });
            DropIndex("dbo.bgm_request", new[] { "job_site_seq" });
            DropIndex("dbo.bgm_request", new[] { "prj_type_seq" });
            DropIndex("dbo.bgm_request", new[] { "bgm_strat_list_seq" });
            DropIndex("dbo.HrmEsMail", new[] { "ReqId" });
            DropIndex("dbo.HrmEsMail", new[] { "ReceiverId" });
            DropIndex("dbo.HrmEsMail", new[] { "SenderId" });
            DropIndex("dbo.HrmEsMail", new[] { "MailTypeId" });
            DropIndex("dbo.HrmEsResponse", new[] { "RespNextId" });
            DropIndex("dbo.HrmEsResponse", new[] { "MailId" });
            DropIndex("dbo.HrmAprAppraisal", new[] { "StdScoreId" });
            DropIndex("dbo.HrmAprAppraisal", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "ScholarGroupId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "ResponseTypeId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "EduQualId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "ApContactDistrictId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "ApCitizenId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "ApFhId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "EduMajorId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "EduInsId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "ScholarId" });
            DropIndex("dbo.HrmScholarshipRequest", new[] { "EmpId" });
            DropIndex("dbo.HrmScholarshipGroupDtls", new[] { "ScholarId" });
            DropIndex("dbo.HrmScholarshipGroupDtls", new[] { "EduMajorId" });
            DropIndex("dbo.HrmScholarshipGroup", new[] { "ScholarId" });
            DropIndex("dbo.HrmScholarship", new[] { "CountryId" });
            DropIndex("dbo.HrmScholarship", new[] { "EduDegreeId" });
            DropIndex("dbo.HrmScholarship", new[] { "ScholarFundId" });
            DropIndex("dbo.HrmScholarship", new[] { "ScholarTypeId" });
            DropIndex("dbo.HrmTrainingSubjectDtls", new[] { "TrainingSubjectId" });
            DropIndex("dbo.HrmTrainer", new[] { "DistrictId" });
            DropIndex("dbo.HrmTrainer", new[] { "EmpId" });
            DropIndex("dbo.HrmTrainer", new[] { "NamePrefixId" });
            DropIndex("dbo.HrmTrainingCourseTrainer", new[] { "TrainingSubjectDtlsId" });
            DropIndex("dbo.HrmTrainingCourseTrainer", new[] { "TrainingSubjectId" });
            DropIndex("dbo.HrmTrainingCourseTrainer", new[] { "TrainerId" });
            DropIndex("dbo.HrmTrainingCourseTrainer", new[] { "TrainId" });
            DropIndex("dbo.HrmTrainingCourseQuota", new[] { "JobSiteId" });
            DropIndex("dbo.HrmTrainingCourseQuota", new[] { "TrainId" });
            DropIndex("dbo.HrmTrainingCourseTrainee", new[] { "JobSiteId" });
            DropIndex("dbo.HrmTrainingCourseTrainee", new[] { "EmpId" });
            DropIndex("dbo.HrmTrainingCourseTrainee", new[] { "TrainId" });
            DropIndex("dbo.HrmTrainingInstitute", new[] { "CountryId" });
            DropIndex("dbo.HrmScholarshipFund", new[] { "ScholarTypeId" });
            DropIndex("dbo.HrmTrainingType", new[] { "TrainingCatId" });
            DropIndex("dbo.HrmTrainingCurriculum", new[] { "TrainingTypeId" });
            DropIndex("dbo.HrmTrainingCourse", new[] { "BgSourceId" });
            DropIndex("dbo.HrmTrainingCourse", new[] { "TrainingGroupId" });
            DropIndex("dbo.HrmTrainingCourse", new[] { "CountryId" });
            DropIndex("dbo.HrmTrainingCourse", new[] { "TrainingInsId" });
            DropIndex("dbo.HrmTrainingCourse", new[] { "EpcId" });
            DropIndex("dbo.HrmTrainingCourse", new[] { "ScholarFundId" });
            DropIndex("dbo.HrmTrainingCourse", new[] { "EmpSecId" });
            DropIndex("dbo.HrmTrainingCourse", new[] { "TrainingCurId" });
            DropIndex("dbo.HrmTrainingRequest", new[] { "StatusId" });
            DropIndex("dbo.HrmTrainingRequest", new[] { "EmpId" });
            DropIndex("dbo.HrmPsTimeAttendant", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpSpecialSkill", new[] { "SkillTypeId" });
            DropIndex("dbo.HrmPsEmpSpecialSkill", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpSpecialExpert", new[] { "EmpId" });
            DropIndex("dbo.HrmScUser", new[] { "JobSiteId" });
            DropIndex("dbo.HrmScUser", new[] { "ScEmpId" });
            DropIndex("dbo.HrmPrSalaryGroup", new[] { "ClassId" });
            DropIndex("dbo.HrmPrSalaryGroup", new[] { "PosTypeId" });
            DropIndex("dbo.HrmPrSalaryGroup", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmPsRoyalItemRepayDtls", new[] { "GenderId" });
            DropIndex("dbo.HrmPsRoyalItemRepayDtls", new[] { "RoyalItemId" });
            DropIndex("dbo.HrmPsRoyalItemRepayDtls", new[] { "RepayId" });
            DropIndex("dbo.HrmPsRoyalItemRequest", new[] { "JobSiteId" });
            DropIndex("dbo.HrmPsRoyalItemRequest", new[] { "ClassId" });
            DropIndex("dbo.HrmPsRoyalItemRequest", new[] { "PosId" });
            DropIndex("dbo.HrmPsRoyalItemRequest", new[] { "CurrRoyalItemId" });
            DropIndex("dbo.HrmPsRoyalItemRequest", new[] { "RoyalItemId" });
            DropIndex("dbo.HrmPsRoyalItemRequest", new[] { "EmpId" });
            DropIndex("dbo.HrmPsRoyalItemHistory", new[] { "RoyalItemId" });
            DropIndex("dbo.HrmPsRoyalItemHistory", new[] { "RoyalItemReqId" });
            DropIndex("dbo.HrmPsRoyalItemHistory", new[] { "EmpId" });
            DropIndex("dbo.HrmPsRoyalItem", new[] { "RoyalItemTypeId" });
            DropIndex("dbo.HrmPsRoyalItemControl", new[] { "RoyalItemId" });
            DropIndex("dbo.HrmPsRoyalItemControl", new[] { "EmpId" });
            DropIndex("dbo.HrmPsRetirementDtls", new[] { "EmpId" });
            DropIndex("dbo.HrmPsRetirementDtls", new[] { "RetireId" });
            DropIndex("dbo.HrmPsRetirement", new[] { "JobSiteId" });
            DropIndex("dbo.HrmPsRetirement", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmRcCatalog", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmPrExtraType", new[] { "ContactId" });
            DropIndex("dbo.HrmPrExtraType", new[] { "CmdTypeId" });
            DropIndex("dbo.HrmPrExtraType", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmMpPositionDutyDtls", new[] { "PosDutyId" });
            DropIndex("dbo.HrmMpPositionDuty", new[] { "DutyId" });
            DropIndex("dbo.HrmMpPositionDuty", new[] { "PosId" });
            DropIndex("dbo.HrmPsNwdJobSite", new[] { "JobSiteId" });
            DropIndex("dbo.HrmPsNwdJobSite", new[] { "NonWorkingId" });
            DropIndex("dbo.MasRegion", new[] { "CountryId" });
            DropIndex("dbo.HrmPsEmpLegatee", new[] { "FamId" });
            DropIndex("dbo.HrmPsEmpLegatee", new[] { "NamePrefixId" });
            DropIndex("dbo.HrmPsEmpLegatee", new[] { "EmpId" });
            DropIndex("dbo.HrmMpJobSiteType", new[] { "CurrJobSiteId" });
            DropIndex("dbo.HrmMpJobSiteType", new[] { "current_HrmMpJobSites_JobSiteId" });
            DropIndex("dbo.HrmMpJobSiteCommandDtls", new[] { "ToJobSiteLevelId" });
            DropIndex("dbo.HrmMpJobSiteCommandDtls", new[] { "FromJobSiteLevelId" });
            DropIndex("dbo.HrmMpJobSiteCommandDtls", new[] { "ToUpperId" });
            DropIndex("dbo.HrmMpJobSiteCommandDtls", new[] { "FromUpperId" });
            DropIndex("dbo.HrmMpJobSiteCommandDtls", new[] { "JobSiteId" });
            DropIndex("dbo.HrmMpJobSiteCommandDtls", new[] { "JobSiteCmdId" });
            DropIndex("dbo.HrmMpJobSiteCommand", new[] { "JobSiteTypeId" });
            DropIndex("dbo.HrmMpJobSiteArea", new[] { "JobSiteId" });
            DropIndex("dbo.HrmPsEmpParent", new[] { "NamePrefixId" });
            DropIndex("dbo.HrmPsEmpParent", new[] { "EmpId" });
            DropIndex("dbo.HrmChgRequest", new[] { "EmpId" });
            DropIndex("dbo.HrmChgRequest", new[] { "ChgTypeId" });
            DropIndex("dbo.HrmChgSpouse", new[] { "NamePrefixId" });
            DropIndex("dbo.HrmChgSpouse", new[] { "SpouseId" });
            DropIndex("dbo.HrmChgSpouse", new[] { "ChgReqId" });
            DropIndex("dbo.HrmPsEmpChildren", new[] { "SpouseId" });
            DropIndex("dbo.HrmPsEmpChildren", new[] { "EduInsId" });
            DropIndex("dbo.HrmPsEmpChildren", new[] { "EduDegreeId" });
            DropIndex("dbo.HrmPsEmpChildren", new[] { "NamePrefixId" });
            DropIndex("dbo.HrmPsEmpChildren", new[] { "GenderId" });
            DropIndex("dbo.HrmPsEmpChildren", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpChildren", new[] { "HrmPsEmployees_EmpId" });
            DropIndex("dbo.HrmPsEmpSpouse", new[] { "NamePrefixId" });
            DropIndex("dbo.HrmPsEmpSpouse", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpMovment", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmPsEmpSalaryHistory", new[] { "MoveId" });
            DropIndex("dbo.HrmPsEmpSalaryHistory", new[] { "JobSiteId" });
            DropIndex("dbo.HrmPsEmpSalaryHistory", new[] { "ClassId" });
            DropIndex("dbo.HrmPsEmpSalaryHistory", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpNameHistory", new[] { "NewPrefixId" });
            DropIndex("dbo.HrmPsEmpNameHistory", new[] { "OldPrefixId" });
            DropIndex("dbo.HrmPsEmpNameHistory", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "CmdTypeId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "MoveId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "JobSiteId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "ClassId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "CmdExecId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "CmdFieldId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "CmdJobSiteId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "CmdClassId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "CmdDtlsId" });
            DropIndex("dbo.HrmPsEmpPositionHistory", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpIncreases", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpGoodness", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpEnglish", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpEnglish", new[] { "HrmPsEmployees_EmpId" });
            DropIndex("dbo.HrmPsEmpEducation", new[] { "EduMajorId" });
            DropIndex("dbo.HrmPsEmpEducation", new[] { "EduInsId" });
            DropIndex("dbo.HrmPsEmpEducation", new[] { "EduQualId" });
            DropIndex("dbo.HrmPsEmpEducation", new[] { "EduDegreeId" });
            DropIndex("dbo.HrmPsEmpEducation", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpEducation", new[] { "HrmPsEmployees_EmpId" });
            DropIndex("dbo.HrmMpFieldSpecification", new[] { "ClassId" });
            DropIndex("dbo.HrmMpFieldSpecification", new[] { "FieldPosId" });
            DropIndex("dbo.HrmMpFieldSpecificationDtls", new[] { "ClassId" });
            DropIndex("dbo.HrmMpFieldSpecificationDtls", new[] { "PosTypeId" });
            DropIndex("dbo.HrmMpFieldSpecificationDtls", new[] { "FieldSpecId" });
            DropIndex("dbo.HrmMpFieldDutyDtls", new[] { "DutyId" });
            DropIndex("dbo.HrmMpFieldDutyDtls", new[] { "FieldDutyId" });
            DropIndex("dbo.HrmMpFieldDuty", new[] { "ClassId" });
            DropIndex("dbo.HrmMpFieldDuty", new[] { "FieldPosId" });
            DropIndex("dbo.HrmMpFieldGroup", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmMpFieldPosition", new[] { "ClassSpecId" });
            DropIndex("dbo.HrmMpFieldPosition", new[] { "FieldGroupId" });
            DropIndex("dbo.HrmMpFieldPosition", new[] { "PosTypeId" });
            DropIndex("dbo.HrmMpFieldPosition", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmMpExecPosition", new[] { "ExecPosGroupId" });
            DropIndex("dbo.HrmPsEmpSkill", new[] { "SkillTypeId" });
            DropIndex("dbo.HrmPsEmpSkill", new[] { "EmpId" });
            DropIndex("dbo.HrmMpPosition", new[] { "CurrencyId" });
            DropIndex("dbo.HrmMpPosition", new[] { "SkillId" });
            DropIndex("dbo.HrmMpPosition", new[] { "PosWorkingUpperId" });
            DropIndex("dbo.HrmMpPosition", new[] { "PosUpperId" });
            DropIndex("dbo.HrmMpPosition", new[] { "JobSiteId" });
            DropIndex("dbo.HrmMpPosition", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmMpPosition", new[] { "ExecPosId" });
            DropIndex("dbo.HrmMpPosition", new[] { "FieldPosId" });
            DropIndex("dbo.HrmPsEmployeeType", new[] { "YearTypeId" });
            DropIndex("dbo.HrmEsQuitRequest", new[] { "ApprovedId" });
            DropIndex("dbo.HrmEsQuitRequest", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpContact", new[] { "DistrictId" });
            DropIndex("dbo.HrmPsEmpContact", new[] { "FamId" });
            DropIndex("dbo.HrmPsEmpContact", new[] { "NamePrefixId" });
            DropIndex("dbo.HrmPsEmpContact", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEmpContact", new[] { "HrmPsEmployees_EmpId" });
            DropIndex("dbo.HrmEsMoveRequest", new[] { "ApprovedId" });
            DropIndex("dbo.HrmEsMoveRequest", new[] { "EmpId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "EntTypeId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "MarrStatId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "BloodGroupId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "EmpStatusId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "NatId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "RaceNatId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "ReligionId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "GenderId" });
            DropIndex("dbo.HrmTmpEmployee", new[] { "NamePrefixId" });
            DropIndex("dbo.MasEduInstitute", new[] { "MaxEduDegreeId" });
            DropIndex("dbo.MasEduInstitute", new[] { "CountryId" });
            DropIndex("dbo.MasEduInstitute", new[] { "DistrictId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "MasEduQualification_EduQualId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "EduInsId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "EduMajorId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "EduQualId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "TmpEmpId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "HrmTmpEmployees_TmpEmpId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "TmpEmployee_TmpEmpId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "MasEduQualifications_EduQualId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "MasEduMajors_EduMajorId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "MasEduMajor_EduMajorId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "MasEduInstitutes_EduInsId" });
            DropIndex("dbo.HrmTmpEmployeeEducation", new[] { "MasEduInstitute_EduInsId" });
            DropIndex("dbo.MasEduQualification", new[] { "EduDegreeId" });
            DropIndex("dbo.HrmPsEduHistory", new[] { "EduInsId" });
            DropIndex("dbo.HrmPsEduHistory", new[] { "EduMajorId" });
            DropIndex("dbo.HrmPsEduHistory", new[] { "EduQualId" });
            DropIndex("dbo.HrmPsEduHistory", new[] { "EduDegreeId" });
            DropIndex("dbo.HrmPsEduHistory", new[] { "EmpId" });
            DropIndex("dbo.HrmPsEduHistory", new[] { "HrmPsEmployees_EmpId" });
            DropIndex("dbo.HrmMpPositionType", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmMpPositionType", new[] { "HrmPsEmployeeTypes_EmpTypeId" });
            DropIndex("dbo.HrmMpClass", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmMpClass", new[] { "PosTypeId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "CurrencyId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "TmpEduId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "TmpEmpId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "EntClassId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "EntPosTypeId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "NewExecPosId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "NewPosTypeId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "NewWorkingJobSiteId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "NewJobSiteId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "NewClassId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "NewPosId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "OldExecPosId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "OldPosTypeId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "OldWorkingJobSiteId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "OldJobSiteId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "OldClassId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "OldPosId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "MoveId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "EduHisId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "new_HrmMpExecPositions_ExecPosId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "new_working_HrmMpJobSites_JobSiteId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "new_HrmMpJobSites_JobSiteId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "new_HrmMpClasses_ClassId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "new_HrmMpPositions_PosId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "old_HrmMpExecPositions_ExecPosId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "old_working_HrmMpJobSites_JobSiteId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "old_HrmMpJobSites_JobSiteId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "old_HrmMpClasses_ClassId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "old_HrmMpPositions_PosId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "EmpId" });
            DropIndex("dbo.HrmPsCommandDtls", new[] { "CmdId" });
            DropIndex("dbo.HrmPsCommandType", new[] { "CmdGroupId" });
            DropIndex("dbo.HrmPsCommandType", new[] { "HrmPsCommandGroups_CmdGroupId" });
            DropIndex("dbo.HrmPsCommand", new[] { "ApprovedId" });
            DropIndex("dbo.HrmPsCommand", new[] { "PenaltyId" });
            DropIndex("dbo.HrmPsCommand", new[] { "JobSiteId" });
            DropIndex("dbo.HrmPsCommand", new[] { "EmpTypeId" });
            DropIndex("dbo.HrmPsCommand", new[] { "CmdTypeId" });
            DropIndex("dbo.HrmPsCommand", new[] { "HrmDcPenalty_PenId" });
            DropIndex("dbo.HrmPsCommand", new[] { "approver_EmpId" });
            DropIndex("dbo.HrmPsCommand", new[] { "HrmMpJobSites_JobSiteId" });
            DropIndex("dbo.HrmPsCommand", new[] { "HrmPsEmployeeTypes_EmpTypeId" });
            DropIndex("dbo.HrmPsCommand", new[] { "HrmPsCommandTypes_CmdTypeId" });
            DropIndex("dbo.HrmFieldPosition", new[] { "ClassSpecId" });
            DropIndex("dbo.hrm_job_site", new[] { "MpJobSiteType_JobSiteTypeId" });
            DropForeignKey("dbo.tablename", "rule_approve_group_seq", "dbo.rule_approve_group");
            DropForeignKey("dbo.HrmActivityRequest", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmActivityRequest", "ActId", "dbo.HrmActivity");
            DropForeignKey("dbo.HrmActivity", "CityId", "dbo.HrmMasCity");
            DropForeignKey("dbo.HrmActivity", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmActivity", "ActTypeId", "dbo.HrmActivityType");
            DropForeignKey("dbo.HrmActivity", "BgmProjOperId", "dbo.bgm_project_operation");
            DropForeignKey("dbo.HrmPsAbsenceRule", "AbsenceTypeId", "dbo.HrmPsAbsenceType");
            DropForeignKey("dbo.HrmPsAbsenceRule", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmPsAbsence", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsAbsence", "AbsenceTypeId", "dbo.HrmPsAbsenceType");
            DropForeignKey("dbo.bgm_request", "job_site_seq", "dbo.hrm_job_site");
            DropForeignKey("dbo.bgm_request", "prj_type_seq", "dbo.bgm_project_type");
            DropForeignKey("dbo.bgm_request", "bgm_strat_list_seq", "dbo.bgm_strategy_data_list");
            DropForeignKey("dbo.HrmEsMail", "ReqId", "dbo.bgm_request");
            DropForeignKey("dbo.HrmEsMail", "ReceiverId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmEsMail", "SenderId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmEsMail", "MailTypeId", "dbo.HrmEsMail");
            DropForeignKey("dbo.HrmEsResponse", "RespNextId", "dbo.HrmEsResponse");
            DropForeignKey("dbo.HrmEsResponse", "MailId", "dbo.HrmEsMail");
            DropForeignKey("dbo.HrmAprAppraisal", "StdScoreId", "dbo.HrmAppraisalStdScore");
            DropForeignKey("dbo.HrmAprAppraisal", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmScholarshipRequest", "ScholarGroupId", "dbo.HrmScholarshipGroup");
            DropForeignKey("dbo.HrmScholarshipRequest", "ResponseTypeId", "dbo.HrmEsResponse");
            DropForeignKey("dbo.HrmScholarshipRequest", "EduQualId", "dbo.MasEduQualification");
            DropForeignKey("dbo.HrmScholarshipRequest", "ApContactDistrictId", "dbo.HrmMasDistrict");
            DropForeignKey("dbo.HrmScholarshipRequest", "ApCitizenId", "dbo.HrmScholarshipRequest");
            DropForeignKey("dbo.HrmScholarshipRequest", "ApFhId", "dbo.HrmAprAppraisal");
            DropForeignKey("dbo.HrmScholarshipRequest", "EduMajorId", "dbo.MasEduMajor");
            DropForeignKey("dbo.HrmScholarshipRequest", "EduInsId", "dbo.HrmPsEmpEducation");
            DropForeignKey("dbo.HrmScholarshipRequest", "ScholarId", "dbo.HrmScholarship");
            DropForeignKey("dbo.HrmScholarshipRequest", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmScholarshipGroupDtls", "ScholarId", "dbo.HrmScholarship");
            DropForeignKey("dbo.HrmScholarshipGroupDtls", "EduMajorId", "dbo.MasEduMajor");
            DropForeignKey("dbo.HrmScholarshipGroup", "ScholarId", "dbo.HrmScholarship");
            DropForeignKey("dbo.HrmScholarship", "CountryId", "dbo.HrmMasCountry");
            DropForeignKey("dbo.HrmScholarship", "EduDegreeId", "dbo.MasEduDegree");
            DropForeignKey("dbo.HrmScholarship", "ScholarFundId", "dbo.HrmScholarshipFund");
            DropForeignKey("dbo.HrmScholarship", "ScholarTypeId", "dbo.HrmScholarshipType");
            DropForeignKey("dbo.HrmTrainingSubjectDtls", "TrainingSubjectId", "dbo.HrmTrainingSubject");
            DropForeignKey("dbo.HrmTrainer", "DistrictId", "dbo.HrmMasDistrict");
            DropForeignKey("dbo.HrmTrainer", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmTrainer", "NamePrefixId", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.HrmTrainingCourseTrainer", "TrainingSubjectDtlsId", "dbo.HrmTrainingSubjectDtls");
            DropForeignKey("dbo.HrmTrainingCourseTrainer", "TrainingSubjectId", "dbo.HrmTrainingSubject");
            DropForeignKey("dbo.HrmTrainingCourseTrainer", "TrainerId", "dbo.HrmTrainer");
            DropForeignKey("dbo.HrmTrainingCourseTrainer", "TrainId", "dbo.HrmTrainingRequest");
            DropForeignKey("dbo.HrmTrainingCourseQuota", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmTrainingCourseQuota", "TrainId", "dbo.HrmTrainingRequest");
            DropForeignKey("dbo.HrmTrainingCourseTrainee", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmTrainingCourseTrainee", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmTrainingCourseTrainee", "TrainId", "dbo.HrmTrainingRequest");
            DropForeignKey("dbo.HrmTrainingInstitute", "CountryId", "dbo.HrmMasCountry");
            DropForeignKey("dbo.HrmScholarshipFund", "ScholarTypeId", "dbo.HrmScholarshipType");
            DropForeignKey("dbo.HrmTrainingType", "TrainingCatId", "dbo.HrmTrainingTypeCategory");
            DropForeignKey("dbo.HrmTrainingCurriculum", "TrainingTypeId", "dbo.HrmTrainingType");
            DropForeignKey("dbo.HrmTrainingCourse", "BgSourceId", "dbo.bgm_mas_source");
            DropForeignKey("dbo.HrmTrainingCourse", "TrainingGroupId", "dbo.HrmTrainingGroup");
            DropForeignKey("dbo.HrmTrainingCourse", "CountryId", "dbo.HrmMasCountry");
            DropForeignKey("dbo.HrmTrainingCourse", "TrainingInsId", "dbo.HrmTrainingInstitute");
            DropForeignKey("dbo.HrmTrainingCourse", "EpcId", "dbo.hrm_executive_position");
            DropForeignKey("dbo.HrmTrainingCourse", "ScholarFundId", "dbo.HrmScholarshipFund");
            DropForeignKey("dbo.HrmTrainingCourse", "EmpSecId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmTrainingCourse", "TrainingCurId", "dbo.HrmTrainingCurriculum");
            DropForeignKey("dbo.HrmTrainingRequest", "StatusId", "dbo.HrmDcStatus");
            DropForeignKey("dbo.HrmTrainingRequest", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsTimeAttendant", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpSpecialSkill", "SkillTypeId", "dbo.MasSkillType");
            DropForeignKey("dbo.HrmPsEmpSpecialSkill", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpSpecialExpert", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmScUser", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmScUser", "ScEmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPrSalaryGroup", "ClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmPrSalaryGroup", "PosTypeId", "dbo.HrmMasPositionType");
            DropForeignKey("dbo.HrmPrSalaryGroup", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmPsRoyalItemRepayDtls", "GenderId", "dbo.hrm_mas_gender");
            DropForeignKey("dbo.HrmPsRoyalItemRepayDtls", "RoyalItemId", "dbo.HrmPsRoyalItem");
            DropForeignKey("dbo.HrmPsRoyalItemRepayDtls", "RepayId", "dbo.HrmPsRoyalItemRepay");
            DropForeignKey("dbo.HrmPsRoyalItemRequest", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsRoyalItemRequest", "ClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmPsRoyalItemRequest", "PosId", "dbo.hrm_position");
            DropForeignKey("dbo.HrmPsRoyalItemRequest", "CurrRoyalItemId", "dbo.HrmPsRoyalItem");
            DropForeignKey("dbo.HrmPsRoyalItemRequest", "RoyalItemId", "dbo.HrmPsRoyalItem");
            DropForeignKey("dbo.HrmPsRoyalItemRequest", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsRoyalItemHistory", "RoyalItemId", "dbo.HrmPsRoyalItem");
            DropForeignKey("dbo.HrmPsRoyalItemHistory", "RoyalItemReqId", "dbo.HrmPsRoyalItemRequest");
            DropForeignKey("dbo.HrmPsRoyalItemHistory", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsRoyalItem", "RoyalItemTypeId", "dbo.HrmPsRoyalItemType");
            DropForeignKey("dbo.HrmPsRoyalItemControl", "RoyalItemId", "dbo.HrmPsRoyalItem");
            DropForeignKey("dbo.HrmPsRoyalItemControl", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsRetirementDtls", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsRetirementDtls", "RetireId", "dbo.HrmPsRetirement");
            DropForeignKey("dbo.HrmPsRetirement", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsRetirement", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmRcCatalog", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmPrExtraType", "ContactId", "dbo.IcmMasContact");
            DropForeignKey("dbo.HrmPrExtraType", "CmdTypeId", "dbo.HrmPsCommandType");
            DropForeignKey("dbo.HrmPrExtraType", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmMpPositionDutyDtls", "PosDutyId", "dbo.HrmMpPositionDuty");
            DropForeignKey("dbo.HrmMpPositionDuty", "DutyId", "dbo.HrmMpDuty");
            DropForeignKey("dbo.HrmMpPositionDuty", "PosId", "dbo.hrm_position");
            DropForeignKey("dbo.HrmPsNwdJobSite", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsNwdJobSite", "NonWorkingId", "dbo.HrmPsNonWorkingDay");
            DropForeignKey("dbo.MasRegion", "CountryId", "dbo.HrmMasCountry");
            DropForeignKey("dbo.HrmPsEmpLegatee", "FamId", "dbo.MasFamilyhood");
            DropForeignKey("dbo.HrmPsEmpLegatee", "NamePrefixId", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.HrmPsEmpLegatee", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmMpJobSiteType", "CurrJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmMpJobSiteType", "current_HrmMpJobSites_JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmMpJobSiteCommandDtls", "ToJobSiteLevelId", "dbo.HrmMasJobSiteLevel");
            DropForeignKey("dbo.HrmMpJobSiteCommandDtls", "FromJobSiteLevelId", "dbo.HrmMasJobSiteLevel");
            DropForeignKey("dbo.HrmMpJobSiteCommandDtls", "ToUpperId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmMpJobSiteCommandDtls", "FromUpperId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmMpJobSiteCommandDtls", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmMpJobSiteCommandDtls", "JobSiteCmdId", "dbo.HrmMpJobSiteCommand");
            DropForeignKey("dbo.HrmMpJobSiteCommand", "JobSiteTypeId", "dbo.HrmMasJobSiteType");
            DropForeignKey("dbo.HrmMpJobSiteArea", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsEmpParent", "NamePrefixId", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.HrmPsEmpParent", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmChgRequest", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmChgRequest", "ChgTypeId", "dbo.ChgTypes");
            DropForeignKey("dbo.HrmChgSpouse", "NamePrefixId", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.HrmChgSpouse", "SpouseId", "dbo.HrmChgSpouse");
            DropForeignKey("dbo.HrmChgSpouse", "ChgReqId", "dbo.HrmChgRequest");
            DropForeignKey("dbo.HrmPsEmpChildren", "SpouseId", "dbo.HrmChgSpouse");
            DropForeignKey("dbo.HrmPsEmpChildren", "EduInsId", "dbo.MasEduInstitute");
            DropForeignKey("dbo.HrmPsEmpChildren", "EduDegreeId", "dbo.MasEduDegree");
            DropForeignKey("dbo.HrmPsEmpChildren", "NamePrefixId", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.HrmPsEmpChildren", "GenderId", "dbo.hrm_mas_gender");
            DropForeignKey("dbo.HrmPsEmpChildren", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpChildren", "HrmPsEmployees_EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpSpouse", "NamePrefixId", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.HrmPsEmpSpouse", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpMovment", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmPsEmpSalaryHistory", "MoveId", "dbo.HrmEsMoveRequest");
            DropForeignKey("dbo.HrmPsEmpSalaryHistory", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsEmpSalaryHistory", "ClassId", "dbo.HrmMpClass");
            DropForeignKey("dbo.HrmPsEmpSalaryHistory", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpNameHistory", "NewPrefixId", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.HrmPsEmpNameHistory", "OldPrefixId", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.HrmPsEmpNameHistory", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "CmdTypeId", "dbo.HrmPsCommandType");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "MoveId", "dbo.HrmEsMoveRequest");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "ClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "CmdExecId", "dbo.HrmPsCommand");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "CmdFieldId", "dbo.HrmFieldPosition");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "CmdJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "CmdClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "CmdDtlsId", "dbo.HrmPsCommandDtls");
            DropForeignKey("dbo.HrmPsEmpPositionHistory", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpIncreases", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpGoodness", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpEnglish", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpEnglish", "HrmPsEmployees_EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpEducation", "EduMajorId", "dbo.MasEduMajor");
            DropForeignKey("dbo.HrmPsEmpEducation", "EduInsId", "dbo.MasEduInstitute");
            DropForeignKey("dbo.HrmPsEmpEducation", "EduQualId", "dbo.MasEduQualification");
            DropForeignKey("dbo.HrmPsEmpEducation", "EduDegreeId", "dbo.MasEduDegree");
            DropForeignKey("dbo.HrmPsEmpEducation", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpEducation", "HrmPsEmployees_EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmMpFieldSpecification", "ClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmMpFieldSpecification", "FieldPosId", "dbo.HrmFieldPosition");
            DropForeignKey("dbo.HrmMpFieldSpecificationDtls", "ClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmMpFieldSpecificationDtls", "PosTypeId", "dbo.HrmMasPositionType");
            DropForeignKey("dbo.HrmMpFieldSpecificationDtls", "FieldSpecId", "dbo.HrmMpFieldSpecification");
            DropForeignKey("dbo.HrmMpFieldDutyDtls", "DutyId", "dbo.HrmMpDuty");
            DropForeignKey("dbo.HrmMpFieldDutyDtls", "FieldDutyId", "dbo.HrmMpFieldDuty");
            DropForeignKey("dbo.HrmMpFieldDuty", "ClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmMpFieldDuty", "FieldPosId", "dbo.HrmFieldPosition");
            DropForeignKey("dbo.HrmMpFieldGroup", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmMpFieldPosition", "ClassSpecId", "dbo.HrmMasClassSpecification");
            DropForeignKey("dbo.HrmMpFieldPosition", "FieldGroupId", "dbo.HrmMpFieldGroup");
            DropForeignKey("dbo.HrmMpFieldPosition", "PosTypeId", "dbo.HrmMasPositionType");
            DropForeignKey("dbo.HrmMpFieldPosition", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmMpExecPosition", "ExecPosGroupId", "dbo.SysExecPosGroup");
            DropForeignKey("dbo.HrmPsEmpSkill", "SkillTypeId", "dbo.MasSkillType");
            DropForeignKey("dbo.HrmPsEmpSkill", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmMpPosition", "CurrencyId", "dbo.MasCurrency");
            DropForeignKey("dbo.HrmMpPosition", "SkillId", "dbo.HrmPsEmpSkill");
            DropForeignKey("dbo.HrmMpPosition", "PosWorkingUpperId", "dbo.hrm_position");
            DropForeignKey("dbo.HrmMpPosition", "PosUpperId", "dbo.hrm_position");
            DropForeignKey("dbo.HrmMpPosition", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmMpPosition", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmMpPosition", "ExecPosId", "dbo.hrm_executive_position");
            DropForeignKey("dbo.HrmMpPosition", "FieldPosId", "dbo.HrmFieldPosition");
            DropForeignKey("dbo.HrmPsEmployeeType", "YearTypeId", "dbo.sys_year_type");
            DropForeignKey("dbo.HrmEsQuitRequest", "ApprovedId", "dbo.HrmPsCommand");
            DropForeignKey("dbo.HrmEsQuitRequest", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpContact", "DistrictId", "dbo.HrmMasDistrict");
            DropForeignKey("dbo.HrmPsEmpContact", "FamId", "dbo.MasFamilyhood");
            DropForeignKey("dbo.HrmPsEmpContact", "NamePrefixId", "dbo.HrmMasNamePrefix");
            DropForeignKey("dbo.HrmPsEmpContact", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEmpContact", "HrmPsEmployees_EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmEsMoveRequest", "ApprovedId", "dbo.HrmPsCommand");
            DropForeignKey("dbo.HrmEsMoveRequest", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmTmpEmployee", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmTmpEmployee", "EntTypeId", "dbo.HrmRcEntryType");
            DropForeignKey("dbo.HrmTmpEmployee", "MarrStatId", "dbo.hrm_mas_marital_status");
            DropForeignKey("dbo.HrmTmpEmployee", "BloodGroupId", "dbo.MasBloodGroup");
            DropForeignKey("dbo.HrmTmpEmployee", "EmpStatusId", "dbo.hrm_mas_employee_status");
            DropForeignKey("dbo.HrmTmpEmployee", "NatId", "dbo.hrm_mas_nationality");
            DropForeignKey("dbo.HrmTmpEmployee", "RaceNatId", "dbo.hrm_mas_nationality");
            DropForeignKey("dbo.HrmTmpEmployee", "ReligionId", "dbo.hrm_mas_religion");
            DropForeignKey("dbo.HrmTmpEmployee", "GenderId", "dbo.hrm_mas_gender");
            DropForeignKey("dbo.HrmTmpEmployee", "NamePrefixId", "dbo.hrm_mas_nationality");
            DropForeignKey("dbo.MasEduInstitute", "MaxEduDegreeId", "dbo.MasEduDegree");
            DropForeignKey("dbo.MasEduInstitute", "CountryId", "dbo.HrmMasCountry");
            DropForeignKey("dbo.MasEduInstitute", "DistrictId", "dbo.HrmMasDistrict");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "MasEduQualification_EduQualId", "dbo.MasEduQualification");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "EduInsId", "dbo.MasEduInstitute");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "EduMajorId", "dbo.MasEduMajor");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "EduQualId", "dbo.MasEduQualification");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "TmpEmpId", "dbo.HrmTmpEmployee");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "HrmTmpEmployees_TmpEmpId", "dbo.HrmTmpEmployee");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "TmpEmployee_TmpEmpId", "dbo.HrmTmpEmployee");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "MasEduQualifications_EduQualId", "dbo.MasEduQualification");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "MasEduMajors_EduMajorId", "dbo.MasEduMajor");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "MasEduMajor_EduMajorId", "dbo.MasEduMajor");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "MasEduInstitutes_EduInsId", "dbo.MasEduInstitute");
            DropForeignKey("dbo.HrmTmpEmployeeEducation", "MasEduInstitute_EduInsId", "dbo.MasEduInstitute");
            DropForeignKey("dbo.MasEduQualification", "EduDegreeId", "dbo.MasEduDegree");
            DropForeignKey("dbo.HrmPsEduHistory", "EduInsId", "dbo.MasEduInstitute");
            DropForeignKey("dbo.HrmPsEduHistory", "EduMajorId", "dbo.MasEduMajor");
            DropForeignKey("dbo.HrmPsEduHistory", "EduQualId", "dbo.MasEduQualification");
            DropForeignKey("dbo.HrmPsEduHistory", "EduDegreeId", "dbo.MasEduDegree");
            DropForeignKey("dbo.HrmPsEduHistory", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsEduHistory", "HrmPsEmployees_EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmMpPositionType", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmMpPositionType", "HrmPsEmployeeTypes_EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmMpClass", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmMpClass", "PosTypeId", "dbo.HrmMpPositionType");
            DropForeignKey("dbo.HrmPsCommandDtls", "CurrencyId", "dbo.MasCurrency");
            DropForeignKey("dbo.HrmPsCommandDtls", "TmpEduId", "dbo.HrmTmpEmployeeEducation");
            DropForeignKey("dbo.HrmPsCommandDtls", "TmpEmpId", "dbo.HrmTmpEmployee");
            DropForeignKey("dbo.HrmPsCommandDtls", "EntClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmPsCommandDtls", "EntPosTypeId", "dbo.HrmMasPositionType");
            DropForeignKey("dbo.HrmPsCommandDtls", "NewExecPosId", "dbo.hrm_executive_position");
            DropForeignKey("dbo.HrmPsCommandDtls", "NewPosTypeId", "dbo.HrmMasPositionType");
            DropForeignKey("dbo.HrmPsCommandDtls", "NewWorkingJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommandDtls", "NewJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommandDtls", "NewClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmPsCommandDtls", "NewPosId", "dbo.hrm_position");
            DropForeignKey("dbo.HrmPsCommandDtls", "OldExecPosId", "dbo.hrm_executive_position");
            DropForeignKey("dbo.HrmPsCommandDtls", "OldPosTypeId", "dbo.HrmMasPositionType");
            DropForeignKey("dbo.HrmPsCommandDtls", "OldWorkingJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommandDtls", "OldJobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommandDtls", "OldClassId", "dbo.hrm_mas_class");
            DropForeignKey("dbo.HrmPsCommandDtls", "OldPosId", "dbo.hrm_position");
            DropForeignKey("dbo.HrmPsCommandDtls", "MoveId", "dbo.HrmEsMoveRequest");
            DropForeignKey("dbo.HrmPsCommandDtls", "EduHisId", "dbo.HrmPsEduHistory");
            DropForeignKey("dbo.HrmPsCommandDtls", "new_HrmMpExecPositions_ExecPosId", "dbo.hrm_executive_position");
            DropForeignKey("dbo.HrmPsCommandDtls", "new_working_HrmMpJobSites_JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommandDtls", "new_HrmMpJobSites_JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommandDtls", "new_HrmMpClasses_ClassId", "dbo.HrmMpClass");
            DropForeignKey("dbo.HrmPsCommandDtls", "new_HrmMpPositions_PosId", "dbo.hrm_position");
            DropForeignKey("dbo.HrmPsCommandDtls", "old_HrmMpExecPositions_ExecPosId", "dbo.hrm_executive_position");
            DropForeignKey("dbo.HrmPsCommandDtls", "old_working_HrmMpJobSites_JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommandDtls", "old_HrmMpJobSites_JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommandDtls", "old_HrmMpClasses_ClassId", "dbo.HrmMpClass");
            DropForeignKey("dbo.HrmPsCommandDtls", "old_HrmMpPositions_PosId", "dbo.hrm_position");
            DropForeignKey("dbo.HrmPsCommandDtls", "EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsCommandDtls", "CmdId", "dbo.HrmPsCommand");
            DropForeignKey("dbo.HrmPsCommandType", "CmdGroupId", "dbo.HrmPsCommandGroup");
            DropForeignKey("dbo.HrmPsCommandType", "HrmPsCommandGroups_CmdGroupId", "dbo.HrmPsCommandGroup");
            DropForeignKey("dbo.HrmPsCommand", "ApprovedId", "dbo.HrmPsCommand");
            DropForeignKey("dbo.HrmPsCommand", "PenaltyId", "dbo.HrmDcPenalty");
            DropForeignKey("dbo.HrmPsCommand", "JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommand", "EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmPsCommand", "CmdTypeId", "dbo.HrmPsCommandType");
            DropForeignKey("dbo.HrmPsCommand", "HrmDcPenalty_PenId", "dbo.HrmDcPenalty");
            DropForeignKey("dbo.HrmPsCommand", "approver_EmpId", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.HrmPsCommand", "HrmMpJobSites_JobSiteId", "dbo.hrm_job_site");
            DropForeignKey("dbo.HrmPsCommand", "HrmPsEmployeeTypes_EmpTypeId", "dbo.hrm_mas_employee_type");
            DropForeignKey("dbo.HrmPsCommand", "HrmPsCommandTypes_CmdTypeId", "dbo.HrmPsCommandType");
            DropForeignKey("dbo.HrmFieldPosition", "ClassSpecId", "dbo.HrmMasClassSpecification");
            DropForeignKey("dbo.hrm_job_site", "MpJobSiteType_JobSiteTypeId", "dbo.HrmMpJobSiteType");
            DropColumn("dbo.hrm_job_site", "MpJobSiteType_JobSiteTypeId");
            DropTable("dbo.tablename");
            DropTable("dbo.rule_approve_group");
            DropTable("dbo.rule_approve_custom_button");
            DropTable("dbo.rule_approve");
            DropTable("dbo.rule_absence");
            DropTable("dbo.HrmActivityRequest");
            DropTable("dbo.HrmActivityType");
            DropTable("dbo.HrmActivity");
            DropTable("dbo.HrmPsAbsenceTypeGroup");
            DropTable("dbo.HrmPsAbsenceRule");
            DropTable("dbo.HrmPsAbsenceType");
            DropTable("dbo.HrmPsAbsence");
            DropTable("dbo.bgm_request");
            DropTable("dbo.HrmEsMail");
            DropTable("dbo.HrmEsResponse");
            DropTable("dbo.HrmAppraisalStdScore");
            DropTable("dbo.HrmAprAppraisal");
            DropTable("dbo.HrmScholarshipRequest");
            DropTable("dbo.HrmScholarshipGroupDtls");
            DropTable("dbo.HrmScholarshipGroup");
            DropTable("dbo.HrmScholarship");
            DropTable("dbo.HrmTrainingSubjectDtls");
            DropTable("dbo.HrmTrainingSubject");
            DropTable("dbo.HrmTrainer");
            DropTable("dbo.HrmTrainingCourseTrainer");
            DropTable("dbo.HrmTrainingCourseQuota");
            DropTable("dbo.HrmTrainingCourseTrainee");
            DropTable("dbo.HrmTrainingGroup");
            DropTable("dbo.HrmTrainingInstitute");
            DropTable("dbo.HrmScholarshipType");
            DropTable("dbo.HrmScholarshipFund");
            DropTable("dbo.HrmTrainingType");
            DropTable("dbo.HrmTrainingCurriculum");
            DropTable("dbo.HrmTrainingCourse");
            DropTable("dbo.HrmTrainingTypeCategory");
            DropTable("dbo.HrmDcStatus");
            DropTable("dbo.HrmTrainingRequest");
            DropTable("dbo.HrmPsTimeAttendant");
            DropTable("dbo.HrmPsEmpSpecialSkill");
            DropTable("dbo.HrmPsEmpSpecialExpert");
            DropTable("dbo.HrmScUser");
            DropTable("dbo.HrmPrSalaryGroup");
            DropTable("dbo.HrmPsRoyalItemRepayDtls");
            DropTable("dbo.HrmPsRoyalItemRepay");
            DropTable("dbo.HrmPsRoyalItemRequest");
            DropTable("dbo.HrmPsRoyalItemHistory");
            DropTable("dbo.HrmPsRoyalItemType");
            DropTable("dbo.HrmPsRoyalItem");
            DropTable("dbo.HrmPsRoyalItemControl");
            DropTable("dbo.HrmPsRetirementDtls");
            DropTable("dbo.HrmPsRetirement");
            DropTable("dbo.HrmRcCatalogStatus");
            DropTable("dbo.HrmRcCatalog");
            DropTable("dbo.HrmMpPositionStatus");
            DropTable("dbo.HrmPrExtraType");
            DropTable("dbo.HrmMpPositionDutyDtls");
            DropTable("dbo.HrmMpPositionDuty");
            DropTable("dbo.HrmPsNwdJobSite");
            DropTable("dbo.HrmPsNonWorkingDay");
            DropTable("dbo.MasSpecialSkillType");
            DropTable("dbo.MasRegion");
            DropTable("dbo.MasRecordStatus");
            DropTable("dbo.MasCountryZone");
            DropTable("dbo.HrmMpArea");
            DropTable("dbo.HrmPsEmpLegatee");
            DropTable("dbo.HrmMpJobSpecification");
            DropTable("dbo.HrmMpJobSiteType");
            DropTable("dbo.HrmMpJobSiteCommandDtls");
            DropTable("dbo.HrmMpJobSiteCommand");
            DropTable("dbo.HrmMpJobSiteArea");
            DropTable("dbo.HrmRcInquireSubject");
            DropTable("dbo.HrmPsEmpParent");
            DropTable("dbo.ChgTypes");
            DropTable("dbo.HrmChgRequest");
            DropTable("dbo.HrmChgSpouse");
            DropTable("dbo.HrmPsEmpChildren");
            DropTable("dbo.HrmPsEmpSpouse");
            DropTable("dbo.HrmPsEmpMovment");
            DropTable("dbo.HrmPsEmpSalaryHistory");
            DropTable("dbo.HrmPsEmpNameHistory");
            DropTable("dbo.HrmPsEmpPositionHistory");
            DropTable("dbo.HrmPsEmpIncreases");
            DropTable("dbo.HrmPsEmpGoodness");
            DropTable("dbo.HrmPsEmpEnglish");
            DropTable("dbo.HrmPsEmpEducation");
            DropTable("dbo.HrmMpFieldSpecification");
            DropTable("dbo.HrmMpFieldSpecificationDtls");
            DropTable("dbo.HrmMpFieldDutyDtls");
            DropTable("dbo.HrmMpFieldDuty");
            DropTable("dbo.HrmMasClassSpecification");
            DropTable("dbo.HrmMpFieldGroup");
            DropTable("dbo.HrmMpFieldPosition");
            DropTable("dbo.SysExecPosGroup");
            DropTable("dbo.HrmMpExecPosition");
            DropTable("dbo.MasSkillType");
            DropTable("dbo.HrmPsEmpSkill");
            DropTable("dbo.HrmMpPosition");
            DropTable("dbo.HrmPsEmployeeType");
            DropTable("dbo.HrmPsEmployeeStatus");
            DropTable("dbo.HrmEsQuitRequest");
            DropTable("dbo.HrmMpDuty");
            DropTable("dbo.HrmMpScope");
            DropTable("dbo.MasFamilyhood");
            DropTable("dbo.HrmPsEmpContact");
            DropTable("dbo.MasCurrency");
            DropTable("dbo.HrmEsMoveRequest");
            DropTable("dbo.HrmRcEntryType");
            DropTable("dbo.MasBloodGroup");
            DropTable("dbo.HrmTmpEmployee");
            DropTable("dbo.MasEduMajor");
            DropTable("dbo.MasEduInstitute");
            DropTable("dbo.HrmTmpEmployeeEducation");
            DropTable("dbo.MasEduQualification");
            DropTable("dbo.MasEduDegree");
            DropTable("dbo.HrmPsEduHistory");
            DropTable("dbo.HrmMpPositionType");
            DropTable("dbo.HrmMpClass");
            DropTable("dbo.HrmPsCommandDtls");
            DropTable("dbo.HrmDcPenalty");
            DropTable("dbo.HrmPsCommandGroup");
            DropTable("dbo.HrmPsCommandType");
            DropTable("dbo.HrmPsCommand");
        }
    }
}
